Skip to content Skip to sidebar Skip to footer

Reverse Sort A 2d Numpy Array In Python

I have a numpy array like: A = array([[-inf, 4, 5, 10, -inf, 1], [-inf, 2, 6, 8, -inf, 1], [-inf, 4, -inf, 10, -inf, 100] ]) I need to sort i

Solution 1:

How about

A.sort()
A[:,::-1]

?

References :

http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.sort.html

http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html

Post a Comment for "Reverse Sort A 2d Numpy Array In Python"