On Dec 21, 2008, at 10:19 PM, [email protected] wrote:
>
>> From the examples that I tried out np.sort, sorts each column
> separately (with axis = 0). If the elements of a row is supposed to
> stay together, then np.sort doesn't work

Well, if the elements are supposed to stay together, why wouldn't you  
tie them first, sort, and then untie them ?

 >>> np.sort(a.view([('',int),('',int)]),0).view(int)

The first view transforms your 2D array into a 1D array of tuples, the  
second one retransforms the 1D array to 2D.

Not sure it's better than your lexsort, haven't timed it.
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to