memmap.sort(axis=-1,kind='quicksort',order=None)¶Sort an array, in-place.
| Parameters: | axis : int, optional
kind : {‘quicksort’, ‘mergesort’, ‘heapsort’}, optional
order : str or list of str, optional
|
|---|
See also
numpy.sortargsortlexsortsearchsortedpartitionNotes
Seesort for notes on the different sorting algorithms.
Examples
>>>a=np.array([[1,4],[3,1]])>>>a.sort(axis=1)>>>aarray([[1, 4], [1, 3]])>>>a.sort(axis=0)>>>aarray([[1, 3], [1, 4]])
Use theorder keyword to specify a field to use when sorting astructured array:
>>>a=np.array([('a',2),('c',1)],dtype=[('x','S1'),('y',int)])>>>a.sort(order='y')>>>aarray([('c', 1), ('a', 2)], dtype=[('x', '|S1'), ('y', '<i4')])