将一个NumPy数组连接到另一个NumPy数组中。

16 浏览
0 Comments

将一个NumPy数组连接到另一个NumPy数组中。

我有一个numpy_array,类似于[ a b c ]

然后我想将它与另一个NumPy数组连接起来(就像我们创建一个列表的列表)。我们如何创建包含NumPy数组的NumPy数组?

我尝试了以下操作,但没有成功:

>>> M = np.array([])
>>> M
array([], dtype=float64)
>>> M.append(a,axis=0)
Traceback (most recent call last):
 File "", line 1, in 
AttributeError: 'numpy.ndarray' object has no attribute 'append'
>>> a
array([1, 2, 3])

0