小编ric*_*ehe的帖子

沿着第二轴连接2个1D numpy阵列

执行

import numpy as np
t1 = np.arange(1,10)
t2 = np.arange(11,20)

t3 = np.concatenate((t1,t2),axis=1)
Run Code Online (Sandbox Code Playgroud)

结果是

Traceback (most recent call last):

  File "<ipython-input-264-85078aa26398>", line 1, in <module>
    t3 = np.concatenate((t1,t2),axis=1)

IndexError: axis 1 out of bounds [0, 1)
Run Code Online (Sandbox Code Playgroud)

为什么报告轴1超出范围?

arrays numpy concatenation index-error numpy-ndarray

9
推荐指数
4
解决办法
3万
查看次数