赞
踩
报错信息:
UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U14'), dtype('int64')) -> None
今天写了一小段关于“numpy.newaxis”的测试代码,在打印输出的时候。
原代码:
- demo_data = np.arange(4)
- demo_data_add = demo_data[:,np.newaxis]
- print("demo_data(原来):" + demo_data)
- print("demo_data_add(添加):" + demo_data_add)
执行后,报以下错误信息:
- UFuncTypeError Traceback (most recent call last)
-
- /tmp/ipykernel_118180/659359597.py in <module>
- 1 demo_data = np.arange(4)
- 2 demo_data_add = demo_data[:,np.newaxis]
- ----> 3 print("demo_data(原来):" + demo_data)
- 4 print("demo_data_add(添加):" + demo_data_add)
-
- UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。