numpy.ma.argsort(a, axis=<class 'numpy._globals._NoValue'>, kind='quicksort', order=None, endwith=True, fill_value=None)
[source]
Return an ndarray of indices that sort the array along the specified axis. Masked values are filled beforehand to fill_value
.
Parameters: |
axis : int, optional Axis along which to sort. If None, the default, the flattened array is used. Changed in version 1.13.0: Previously, the default was documented to be -1, but that was in error. At some future date, the default will change to -1, as originally intended. Until then, the axis should be given explicitly when kind : {‘quicksort’, ‘mergesort’, ‘heapsort’}, optional Sorting algorithm. order : list, optional When endwith : {True, False}, optional 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. fill_value : {var}, optional Value used internally for the masked values. If |
---|---|
Returns: |
index_array : ndarray, int Array of indices that sort |
See also
MaskedArray.sort
lexsort
ndarray.sort
See sort
for notes on the different sorting algorithms.
>>> 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])
© 2008–2017 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.14.2/reference/generated/numpy.ma.argsort.html