Answers for "numpy sort ascending"

0

numpy sort row by

sorted_array = an_array[numpy.argsort(an_array[:, 1])]
Posted by: Guest on January-04-2021
3

numpy sort

>>> a = np.array([[1,4],[3,1]])
>>> np.sort(a)                # sort along the last axis
array([[1, 4],
       [1, 3]])
>>> np.sort(a, axis=None)     # sort the flattened array
array([1, 1, 3, 4])
>>> np.sort(a, axis=0)        # sort along the first axis
array([[1, 1],
       [3, 4]])
Posted by: Guest on May-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language