Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ma.argsort

numpy.ma.argsort(a,axis=<no value>,kind='quicksort',order=None,endwith=True,fill_value=None)[source]

Return an ndarray of indices that sort the array along thespecified axis. Masked values are filled beforehand tofill_value.

Parameters:
axis:int, optional

Axis along which to sort. If None, the default, the flattened arrayis used.

Changed in version 1.13.0:Previously, the default was documented to be -1, but that wasin error. At some future date, the default will change to -1, asoriginally intended.Until then, the axis should be given explicitly whenarr.ndim>1, to avoid a FutureWarning.

kind:{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, optional

Sorting algorithm.

order:list, optional

Whena is an array with fields defined, this argument specifieswhich fields to compare first, second, etc. Not all fields need bespecified.

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 thedatatype, the ordering of these values and the masked values isundefined.

fill_value:{var}, optional

Value used internally for the masked values.Iffill_value is not None, it supersedesendwith.

Returns:
index_array:ndarray, int

Array of indices that sorta along the specified axis.In other words,a[index_array] yields a sorteda.

See also

MaskedArray.sort
Describes sorting algorithms used.
lexsort
Indirect stable sort with multiple keys.
ndarray.sort
Inplace sort.

Notes

Seesort for notes on the different sorting algorithms.

Examples

>>>a=np.ma.array([3,2,1],mask=[False,False,True])>>>amasked_array(data = [3 2 --],             mask = [False False  True],       fill_value = 999999)>>>a.argsort()array([1, 0, 2])

Previous topic

numpy.ma.ptp

Next topic

numpy.ma.sort

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp