Lets say I have a numpy 2D array like this:
a = np.array([[3,6,7],[1,9,4],[ 3,7,8],[2,5,10]])
a
# array([[ 3, 6, 7],
# [ 1, 9, 4],
# [ 3, 7, 8],
# [ 2, 5, 10]])
I need to sort the rows descending based on the first column and ascending on the second column to get the below result:
array([[ 3, 6, 7],
[ 3, 7, 8],
[ 2, 5, 10],
[ 1, 9, 4]])
Doing this in Matlab was simple using sortrows(my_matrix,[-1 2]) where -1 for the first column descending and 2 for the second column ascending.
I wonder if there is a function like that in numpy.