📜  按列对数组 python 排序 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:41.739000             🧑  作者: Mango

代码示例1
Sorting a NumPy array by a column orders its rows based 
on the ordering of the values in the column. 
For example, sorting the array [[8 2 -2] [-4 1 7] [6 3 9]] 
by its second column returns [[-4 1 7] [8 2 -2] [6 3 9]].
USE numpy.args

sorted_array = an_array[numpy.argsort(an_array[:, 1])]