dpnp.ndarray.argsort
method
- ndarray.argsort(axis=-1, kind=None, order=None, *, descending=False, stable=None)
Return an ndarray of indices that sort the array along the specified axis.
Refer to
dpnp.argsortfor full documentation.- Parameters:
axis ({None, int}, optional) -- Axis along which to sort. If
None, the array is flattened before sorting. The default is-1, which sorts along the last axis. Default:-1.kind ({None, "stable", "mergesort", "radixsort"}, optional) -- Sorting algorithm. The default is
None, which uses parallel merge-sort or parallel radix-sort algorithms depending on the array data type. Default:None.descending (bool, optional) -- Sort order. If
True, the array must be sorted in descending order (by value). IfFalse, the array must be sorted in ascending order (by value). Default:False.stable ({None, bool}, optional) -- Sort stability. If
True, the returned array will maintain the relative order of a values which compare as equal. The same behavior applies when set toFalseorNone. Internally, this option selectskind="stable". Default:None.
See also
dpnp.sortReturn a sorted copy of an array.
dpnp.argsortReturn the indices that would sort an array.
dpnp.lexsortIndirect stable sort on multiple keys.
dpnp.searchsortedFind elements in a sorted array.
dpnp.partitionPartial sort.
Examples
>>> import dpnp as np >>> a = np.array([3, 1, 2]) >>> a.argsort() array([1, 2, 0])
>>> a = np.array([[0, 3], [2, 2]]) >>> a.argsort(axis=0) array([[0, 1], [1, 0]])