• 输入
a = np.array([[9, 2, 3],
[4, 5, 6],
[7, 0, 5]])

b = a[a[:, 1].argsort()]

print(a)
print(b)
  • 输出
[[9 2 3]
[4 5 6]
[7 0 5]]
[[7 0 5]
[9 2 3]
[4 5 6]]

Ref: https://stackoverflow.com/questions/2828059/sorting-arrays-in-numpy-by-column