argsort¶
- argsort(x: array, /, *, axis: int = -1, descending: bool = False, stable: bool = True) array¶
Returns the indices that sort an array
xalong a specified axis.- Parameters:
x (array) – input array.
axis (int) – axis along which to sort. If set to
-1, the function must sort along the last axis. Default:-1.descending (bool) – sort order. If
True, the returned indices sortxin descending order (by value). IfFalse, the returned indices sortxin ascending order (by value). Default:False.stable (bool) – sort stability. If
True, the returned indices must maintain the relative order ofxvalues which compare as equal. IfFalse, the returned indices may or may not maintain the relative order ofxvalues which compare as equal (i.e., the relative order ofxvalues which compare as equal is implementation-dependent). Default:True.
- Returns:
out (array) – an array of indices. The returned array must have the same shape as
x. The returned array must have the default array index data type.