[numpy] numpy.concatenate((a1,a2,...), axis=0) 数据拼接

http://blog.csdn.net/brucewong0516/article/details/79158758
concatenate((a1, a2, …), axis=0)
默认是 axis = 0 即新数据从下添加到原数据
如:
In [23]: a = np.array([[1, 2], [3, 4]])
In [24]: b = np.array([[5, 6]])
In [25]: np.concatenate((a, b), axis=0)
Out[25]:array([[1, 2],
        [3, 4],
        [5, 6]])

当axis = 1时,数据从右添加,注意维度要相适应
In [28]: np.concatenate((a, b.T ),axis = 1)
Out[28]:array([[1, 2, 5],
        [3, 4, 6]])


你可能感兴趣的:(numpy)