San*_*osh 16 python arrays numpy
我想将numpy数组存储到另一个numpy数组中
我在用 np.concatenate
这是我的代码
x=np.concatenate(x,s_x)
Run Code Online (Sandbox Code Playgroud)
这些是类型和形状 x and s_x
Type of s_x: <class 'numpy.ndarray'>, Shape of s_x: (173,)
Type of x: <class 'numpy.ndarray'> (0,), Shape of x: (0,)
Run Code Online (Sandbox Code Playgroud)
这是显示的错误
TypeError: only integer scalar arrays can be converted to a scalar index
Run Code Online (Sandbox Code Playgroud)
Nil*_*ner 49
您需要将数组作为可迭代(元组或列表)传递,因此正确的语法是
x=np.concatenate((x, s_x))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
45544 次 |
最近记录: |