Return an ndarray of indices that sort the array along the specified axis. Masked values are filled beforehand to fill_value.
Axis along which to sort. If None, the default, the flattened array is used.
The sorting algorithm used.
When a is an array with fields defined, this argument specifies which fields to compare first, second, etc. Not all fields need be specified.
Whether missing values (if any) should be treated as the largest values (True) or the smallest values (False) When the array contains unmasked values at the same extremes of the datatype, the ordering of these values and the masked values is undefined.
Value used internally for the masked values. If fill_value is not None, it supersedes endwith.
Only for compatibility with np.argsort. Ignored.
Array of indices that sort a along the specified axis. In other words, a[index_array] yields a sorted a.
See also
ma.MaskedArray.sortDescribes sorting algorithms used.
lexsortIndirect stable sort with multiple keys.
numpy.ndarray.sortInplace sort.
See sort for notes on the different sorting algorithms.
>>> import numpy as np
>>> a = np.ma.array([3,2,1], mask=[False, False, True])
>>> a
masked_array(data=[3, 2, --],
mask=[False, False, True],
fill_value=999999)
>>> a.argsort()
array([1, 0, 2])
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.ma.argsort.html