Sorting, searching, and counting#

Sorting#

sort(a[, axis, kind])

Returns a sorted copy of an array with a stable sorting algorithm.

lexsort(keys)

Perform an indirect sort using an array of keys.

argsort(a[, axis, kind])

Returns the indices that would sort an array with a stable sorting.

msort(a)

Returns 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.

partition(a, kth[, axis])

Returns a partitioned copy of an array.

argpartition(a, kth[, axis])

Returns the indices that would partially sort an array.

Searching#

argmax(a[, axis, dtype, out, keepdims])

Returns the indices of the maximum along an axis.

nanargmax(a[, axis, dtype, out, keepdims])

Return the indices of the maximum values in the specified axis ignoring NaNs.

argmin(a[, axis, dtype, out, keepdims])

Returns the indices of the minimum along an axis.

nanargmin(a[, axis, dtype, out, keepdims])

Return the indices of the minimum values in the specified axis ignoring NaNs.

argwhere(a)

Return the indices of the elements that are non-zero.

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, sorter])

Finds indices where elements should be inserted to maintain order.

extract(condition, a)

Return the elements of an array that satisfy some condition.

Counting#

count_nonzero(a[, axis])

Counts the number of non-zero values in the array.