[SciPy-user] Sort and N dimensional array by 1d array

Christopher Clarke cclarke@chrisdev....
Wed Feb 21 12:51:18 CST 2007


Hi
I am looking for an efficient way put a two dimensional array in the  
same order as a 1 d array
In the case of arrays  key, b and c
key=array([1,3,6,0 ,4])
b = array([6,7,8,9,11])
c=array([[6,10],[7,11],[8,6],[2,5],[21,55]])
ixs=argsort(key)
sb=take(b,ixs)

however for when i do
sc=take(c,ixs)
sc.shape=(5,) (i've lost the second column)

does this mean i have to go
take(c[:,0],ixs)
take(c[:,1],ixs)
and concatenate the results. I know i am supposed to figure out how  
to specify the 2d sorted indecies  for the 2 d array but???
Regards
Chris






More information about the SciPy-user mailing list