numpy中的concatenate

首先看看两个例子:

In [36]: a=np.arange(6).reshape((2,3))

In [37]: a
Out[37]:
array([[0, 1, 2],
       [3, 4, 5]])

In [38]: b
Out[38]:
array([[ 6,  7,  8],
       [ 9, 10, 11]])

In [39]: np.concatenate((a,b),axis=0)
Out[39]:
array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [ 9, 10, 11]])
In [40]: a=np.arange(5)

In [41]: b=np.arange(5,10)

In [42]: a
Out[42]: array([0, 1, 2, 3, 4])

In [43]: b
Out[43]: array([5,6,7,8,9])

In [44]: np.concatenate((a,b),axis=0)
Out[44]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

你可能感兴趣的:(python)