Skip to main content

sort

Return a sorted copy of an array along the given axis.
Returns: NDArray — A sorted copy of the input array.

argsort

Return the indices that would sort an array along the given axis.
Returns: NDArray — Array of indices that sort the input along the given axis.

lexsort

Perform an indirect stable sort using a sequence of keys. The last key is the primary sort key, the second-to-last is the secondary key, and so on.
Returns: NDArray — Array of indices that sort the data lexicographically.

partition

Rearrange elements such that the element at the kth position is where it would be in a fully sorted array. Elements before kth are all smaller, and elements after are all larger, but neither partition is necessarily sorted internally.
Returns: NDArray — A partitioned copy of the array.

argpartition

Return indices that would partition an array. The element at the kth index in the returned order is in its final sorted position.
Returns: NDArray — Array of indices that partition the input.

sort_complex

Sort an array by real part first, then by imaginary part for ties. Always returns a complex-typed result.
Returns: NDArray — Sorted complex array.