It is used to sort an array,in-place.
Syntax:
ndarray.sort(axis=-1, kind='quicksort', order=None)
Example:
import numpy as np
a=np.array([[1,4,3],[2,6,5]])
a.sort(axis=1)
print(a)
Output:
[[1 3 4] [2 5 6]]
- Log in to post comments
It is used to sort an array,in-place.
ndarray.sort(axis=-1, kind='quicksort', order=None)
import numpy as np
a=np.array([[1,4,3],[2,6,5]])
a.sort(axis=1)
print(a)
Output:
[[1 3 4] [2 5 6]]