As NumPy users, we sometimes find ourselves having special needs for instance financial calculations or signal processing. Fortunately, NumPy provides for most of our needs. This chapter describes some of the more specialized NumPy functions.
In this chapter we will cover the following topics:
NumPy has several data sorting routines, as follows:
sort
function returns a sorted arraylexsort
function performs sorting with a list of keysargsort
function returns the indices that would sort an arrayndarray
class has a sort
method that performs place sortingmsort
function sorts an array along the first axissort_complex
function sorts complex numbers by their real part and then their imaginary partFrom this list argsort
and sort
are available as methods on NumPy arrays as well.