np的concatenate

import  numpy as np
e = np.array([[[1,2], [3,4],['a','b']], [[5,6], [7,8],['c','d']]])
a = np.array([[1, 2], [3, 4]])
b = np.array([[5, 6]])
c=np.concatenate((a, b), axis=0)
# 默认按行连接,那么除了第一维度,其他维度的要全部一致
# a是2*2,b是1*2
print(c)
D=np.concatenate((a, b.T), axis=1)
# 按列连接,那么除了第二维度,其他要一致
# a的shape是2*2,b.T是2*1
print(b.T.shape)
print(b.T)
print(D)
print(np.concatenate(a))
print(np.concatenate(e))

 

你可能感兴趣的:(numpy)