numpy.ma.sort(a,axis=-1,kind='quicksort',order=None,endwith=True,fill_value=None)[source]¶Sort the array, in-place
| Parameters: | a : array_like
axis : int, optional
kind : {‘quicksort’, ‘mergesort’, ‘heapsort’}, optional
order : list, optional
endwith : {True, False}, optional
fill_value : {var}, optional
|
|---|---|
| Returns: | sorted_array : ndarray
|
See also
ndarray.sortargsortlexsortsearchsortedNotes
Seesort for notes on the different sorting algorithms.
Examples
>>>a=ma.array([1,2,5,4,3],mask=[0,1,0,1,0])>>># Default>>>a.sort()>>>print(a)[1 3 5 -- --]
>>>a=ma.array([1,2,5,4,3],mask=[0,1,0,1,0])>>># Put missing values in the front>>>a.sort(endwith=False)>>>print(a)[-- -- 1 3 5]
>>>a=ma.array([1,2,5,4,3],mask=[0,1,0,1,0])>>># fill_value takes over endwith>>>a.sort(endwith=False,fill_value=3)>>>print(a)[1 -- -- 3 5]