sorting arrays in numpy by column

Posted by user248237 on Stack Overflow See other posts from Stack Overflow or by user248237
Published on 2010-05-13T15:32:57Z Indexed on 2010/05/13 16:14 UTC
Read the original article Hit count: 442

Filed under:
|
|
|

How can I sort an array in numpy by the nth column? e.g.

a = array([[1,2,3],[4,5,6],[0,0,1]])

I'd like to sort by the second column, such that I get back:

array([[0,0,1],[1,2,3],[4,5,6]])

thanks.

© Stack Overflow or respective owner

Related posts about numpy

Related posts about scipy