9951 explained code solutions for 126 technologies


python-numpyHow to sort Numpy array


import numpy as np
a = np.array([3, 1, 4, 2, 5])

sorted = np.sort(a)ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

np.sort

returns a sorted copy of an array

sorted

will contain sorted array