Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 1D numpy串联:TypeError:只能将整数标量数组转换为标量索引_Python_Arrays_Numpy - Fatal编程技术网

Python 1D numpy串联:TypeError:只能将整数标量数组转换为标量索引

Python 1D numpy串联:TypeError:只能将整数标量数组转换为标量索引,python,arrays,numpy,Python,Arrays,Numpy,我想将numpy数组存储到另一个numpy数组中 我正在使用np.concatenate 这是我的密码 x=np.concatenate(x,s_x) 这些是x和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,) 您需要将数组作为iterable(元组或列表)传递,因此

我想将numpy数组存储到另一个numpy数组中

我正在使用
np.concatenate

这是我的密码

x=np.concatenate(x,s_x)
这些是
x和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,)

您需要将数组作为iterable(元组或列表)传递,因此需要正确的语法

x=np.concatenate((x, s_x))

对于这样一个常见且有用的函数,它确实包含了最无用的错误消息。谢谢Python很棒,但正是这种吹毛求疵的做法有时会让人头疼。我很幸运地向下滚动谷歌搜索结果,找到了这个答案。@UlissesBraga Neto的问题不在于Python,而在于numpy。错误消息应提供更多信息。
x=np.concatenate((x, s_x))