np.sort

tech2025-01-11  11

a = np.array([[4, 3, 5], [1, 2, 1]]) b = np.sort(a, axis=1) # axis=1 表示按行排序,默认升序 print (“b=”,"\n",b)

out: b = [[3,4,5], [1,1,2]]

最新回复(0)