数组的拼接
数组t1
t1 = np.arange(12).reshape(2,6)
print(t1)
[[ 0 1 2 3 4 5]
[ 6 7 8 9 10 11]]
数组t2
t2 = np.arange(12,24).reshape(2,6)
print(t2)
[[12 13 14 15 16 17]
[18 19 20 21 22 23]]
数组t1 竖直拼接 数组t2 vstack
print(np.vstack((t1,t2)))
[[ 0 1 2 3 4 5]
[ 6 7 8 9 10 11]
[12 13 14 15 16 17]
[18 19 20 21 22 23]]
数组t1 水平拼接 数组t2 hstack
print(np.hstack((t1,t2)))
[[ 0 1 2 3 4 5 12 13 14 15 16 17]
[ 6 7 8 9 10 11 18 19 20 21 22 23]]
数组的行列交换
t3 = np.arange(24).reshape(4,6)
print(t3)
[[ 0 1 2 3 4 5]
[ 6 7 8 9 10 11]
[12 13 14 15 16