I understood that sorting a numpy array
arr = [[11,25],[33,4]]
I assume that
arr is a numpy array? I haven't seen the syntax
arr[:,1] in any other context in python. It would be worth mentioning this in your question!
Assuming this is the case, then you should be using
to sort by column and
to sort by row. (Both sort in-place, i.e. change the value of
arr. If you don't want this you can copy
arr into another variable first, and apply
sort to that.)
If you want to sort just a single row (in this case, the second one) then
Edit: I now understand what problem you are trying to solve. You would like to reorder the columns in the matrix so that the nth row goes in increasing order. You can do this simply by
(where here we're sorting by the 2nd row).