如果 a = np.arange(0,10)
b = np.arange(1,11)
c = np.arange(2,12)
既 a b c都是一维, 可以通过 np.vstack(a,b,c) 然后转置
将数据abc按列合并
如果b 为
[ 1, 2, 3], [ 5, 6, 7], [ 9, 10, 11], [13, 14, 15], [17, 18, 19], [21, 22, 23], [25, 26, 27], [29, 30, 31], [33, 34, 35], [37, 38, 39]]
d为,
array([[ 1], [ 5], [ 9], [13], [17], [21], [25], [29], [33], [37]]
则可以通过
e = np.concatenate((d,b),axis=1)
合并为:
array([[ 1, 1, 2, 3], [ 5, 5, 6, 7], [ 9, 9, 10, 11], [13, 13, 14, 15], [17, 17, 18, 19], [21, 21, 22, 23], [25, 25, 26, 27], [29, 29, 30, 31], [33, 33, 34, 35], [37, 37, 38, 39]])
vstack((a,b))如果ab本身为二维数组且列数相同时,可以用来将两个二维数组相加