How to Sort NumPy Arrays of Numbers


In this example we will show how to sort NumPy arrays of numbers in Python.

Source Code

import numpy as np

n = np.array([1, 8, 3, 6, 5, 7, 2])

print(np.sort(n))

Output:

[1 2 3 5 6 7 8]
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments