You can sort the NumPy array with the following code. If you want to learn Python, I highly recommend reading This Book.
Example 1
import numpy as np # Original Array a = np.array([10, 5, 20, 1]) # Sorted Array b = np.sort(a) # Display sorted Array print(b)
Output
[ 1 5 10 20]
Example 2
import numpy as np # Original Array a = np.array([[10, 5, 20, 1],[15, 5, 30, 25]]) # Sorted Array b = np.sort(a) # Display sorted Array print(b)
Output
[[ 1 5 10 20] [ 5 15 25 30]]
People are also reading:
What is Computer Vision? Examples, Applications, Techniques
Books for Machine Learning (ML)