sort(self, axis=-1, kind=None, order=None, endwith=True, fill_value=None)
See sort
for notes on the different sorting algorithms.
Array to be sorted.
Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis.
The sorting algorithm used.
When a
is a structured array, this argument specifies which fields to compare first, second, and so on. This list does not need to include all of the fields.
Whether missing values (if any) should be treated as the largest values (True) or the smallest values (False) When the array contains unmasked values sorting 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
.
Array of the same type and shape as a
.
Sort the array, in-place
argsort
Indirect sort.
lexsort
Indirect stable sort on multiple keys.
numpy.ndarray.sort
Method to sort an array in-place.
searchsorted
Find elements in a sorted array.
>>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])This example is valid syntax, but we were not able to check execution
... # Default
... a.sort()
... a masked_array(data=[1, 3, 5, --, --], mask=[False, False, False, True, True], fill_value=999999)
>>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])This example is valid syntax, but we were not able to check execution
... # Put missing values in the front
... a.sort(endwith=False)
... a masked_array(data=[--, --, 1, 3, 5], mask=[ True, True, False, False, False], fill_value=999999)
>>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])See :
... # fill_value takes over endwith
... a.sort(endwith=False, fill_value=3)
... a masked_array(data=[1, --, --, 3, 5], mask=[False, True, True, False, False], fill_value=999999)
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.ma.core.sort
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them