MCPcopy
hub / github.com/numpy/numpy / sort

Method sort

numpy/ma/core.py:5782–5873  ·  view source on GitHub ↗

Sort the array, in-place Parameters ---------- a : array_like Array to be sorted. axis : int, optional Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last

(self, axis=-1, kind=None, order=None, endwith=True,
             fill_value=None, *, stable=False, descending=False)

Source from the content-addressed store, hash-verified

5780 return d.argmax(axis, out=out, keepdims=keepdims)
5781
5782 def sort(self, axis=-1, kind=None, order=None, endwith=True,
5783 fill_value=None, *, stable=False, descending=False):
5784 """
5785 Sort the array, in-place
5786
5787 Parameters
5788 ----------
5789 a : array_like
5790 Array to be sorted.
5791 axis : int, optional
5792 Axis along which to sort. If None, the array is flattened before
5793 sorting. The default is -1, which sorts along the last axis.
5794 kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional
5795 The sorting algorithm used.
5796 order : list, optional
5797 When `a` is a structured array, this argument specifies which fields
5798 to compare first, second, and so on. This list does not need to
5799 include all of the fields.
5800 endwith : {True, False}, optional
5801 Whether missing values (if any) should be treated as the largest values
5802 (True) or the smallest values (False)
5803 When the array contains unmasked values sorting at the same extremes of the
5804 datatype, the ordering of these values and the masked values is
5805 undefined.
5806 fill_value : scalar or None, optional
5807 Value used internally for the masked values.
5808 If ``fill_value`` is not None, it supersedes ``endwith``.
5809 stable : bool, optional
5810 Only for compatibility with ``np.sort``. Ignored.
5811 descending : bool, optional
5812 Only for compatibility with ``np.sort``. Ignored.
5813
5814 See Also
5815 --------
5816 numpy.ndarray.sort : Method to sort an array in-place.
5817 argsort : Indirect sort.
5818 lexsort : Indirect stable sort on multiple keys.
5819 searchsorted : Find elements in a sorted array.
5820
5821 Notes
5822 -----
5823 See ``sort`` for notes on the different sorting algorithms.
5824
5825 Examples
5826 --------
5827 >>> import numpy as np
5828 >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
5829 >>> # Default
5830 >>> a.sort()
5831 >>> a
5832 masked_array(data=[1, 3, 5, --, --],
5833 mask=[False, False, False, True, True],
5834 fill_value=999999)
5835
5836 >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
5837 >>> # Put missing values in the front
5838 >>> a.sort(endwith=False)
5839 >>> a

Callers 15

get_authorsFunction · 0.45
get_pull_requestsFunction · 0.45
find_c_cpp_filesFunction · 0.45
mainFunction · 0.45
test_sort_matrix_noneFunction · 0.45
polyFunction · 0.45
histogramFunction · 0.45
sort_complexFunction · 0.45
_unique1dFunction · 0.45
intersect1dFunction · 0.45
setxor1dFunction · 0.45
join_byFunction · 0.45

Calls 1

argsortMethod · 0.95

Tested by 15

test_sort_matrix_noneFunction · 0.36
test_sort_realMethod · 0.36
test_rootsMethod · 0.36
test_roots_dtypeMethod · 0.36
test_unique_1dMethod · 0.36
test_eig_buildMethod · 0.36
doMethod · 0.36
doMethod · 0.36