[Numpy-discussion] how to do a proper 2 column sort on a 2 dimensional array ??

robert somerville somervi8@telus....
Tue Jan 19 11:53:36 CST 2010


Hi;
 i am having trouble trying to sort the rows of a 2 dimensional array by the
values in the first column .. does anybody know how or have an example of
how to do this ??? while leaving the remain columns remain relative to the
leading column

from numpy import *

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

i would like to generate the output (or get the output ...)

b = [ [3,1,1], [4,4,3], [4,5,2] ]

to be specific the primary sort is on the the first column, and within the
primary key, i would like to do a seconday sort of the matrix based on 2nd
column ..

does Numpy have this finctionality, or do part have to be programmed in
Python ??

thanks;
bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100119/0b001cf2/attachment.html 


More information about the NumPy-Discussion mailing list