Sorting, searching, and counting


sort(a[, axis, kind, order]) Return a sorted copy of an array.
lexsort(keys[, axis]) Perform an indirect sort using a sequence of keys.
argsort(a[, axis, kind, order]) Returns the indices that would sort an array.
ndarray.sort(axis=-1[, kind, order]) Sort an array, in-place.
msort(a) Return a copy of an array sorted along the first axis.
sort_complex(a) Sort a complex array using the real part first, then the imaginary part.


argmax(a[, axis]) Indices of the maximum values along an axis.
nanargmax(a[, axis]) Return indices of the maximum values over an axis, ignoring NaNs.
argmin(a[, axis]) Return the indices of the minimum values along an axis.
nanargmin(a[, axis]) Return indices of the minimum values over an axis, ignoring NaNs.
argwhere(a) Find the indices of array elements that are non-zero, grouped by element.
nonzero(a) Return the indices of the elements that are non-zero.
flatnonzero(a) Return indices that are non-zero in the flattened version of a.
where(condition, [x, y]) Return elements, either from x or y, depending on condition.
searchsorted(a, v[, side]) Find indices where elements should be inserted to maintain order.
extract(condition, arr) Return the elements of an array that satisfy some condition.


count_nonzero(a) Counts the number of non-zero values in the array a.

Table Of Contents

Previous topic


Next topic


This Page