HOW TO SORT PYTHON NUMPY ARRAYS?

The sort() method is used to sort the array in an order, it returns a copy of the array, leaving the original array unchanged.

import numpy as np

arr1 = np.array([5, 2, 4, 1])

print(np.sort(arr1))

Output-

[1 2 4 5]

Posted

in

Tags:

Comments

Leave a Reply