当前位置:   article > 正文

UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching types (dtype(‘<U14‘), dty_ufunc 'add' did not contain a loop with signature

ufunc 'add' did not contain a loop with signature matching types (dtype('int

报错信息:

UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U14'), dtype('int64')) -> None

今天写了一小段关于“numpy.newaxis”的测试代码,在打印输出的时候。

原代码:

  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)

执行后,报以下错误信息:

  1. UFuncTypeError Traceback (most recent call last)
  2. /tmp/ipykernel_118180/659359597.py in <module>
  3. 1 demo_data = np.arange(4)
  4. 2 demo_data_add = demo_data[:,np.newaxis]
  5. ----> 3 print("demo_data(原来):" + demo_data)
  6. 4 print("demo_data_add(添加):" + demo_data_add)
  7. UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype(
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/914299
推荐阅读
  

闽ICP备14008679号