Sorting
NumPy has several data sorting routines, as follows:
The
sort
function returns a sorted arrayThe
lexsort
function performs sorting with a list of keysThe
argsort
function returns the indices that would sort an arrayThe
ndarray
class has asort
method that performs place sortingThe
msort
function sorts an array along the first axisThe
sort_complex
function sorts complex numbers by their real part and then their imaginary part
From this list argsort
and sort
are available as methods on NumPy arrays as well.