How to sort the following array in descending order of the first column:
dl1 = numpy.array([[ 0.02598003,1.],
[ 0.00730082,2.],
[ 0.05471569,3.],
[ 0.02599167,4.],
[ 0.0544947 ,5.],
[ 0.00753346,6.]])
Other places on the Internet say that direct dl1.sort() will sort by the first column by default, but it doesn’t seem to work
np.sort sorts each dimension separately
If you want joint sorting of two-dimensional groups, use the
np.argsort
methodIf there is a lot of data, using python’s internal
sorted
will reduce efficiencyndarray.sort
的关键字参数axis
It is used to sort by a certain column