numpy交换列

x = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print(x)

x = x[:, [1, 0, 2]]
print(x)

输出

[[1 2 3]
 [4 5 6]
 [7 8 9]]
[[2 1 3]
 [5 4 6]
 [8 7 9]]
原文地址:https://www.cnblogs.com/punkrocker/p/10791702.html