[Numpy-discussion] lexsort

Tom Denniston tom.denniston at alum.dartmouth.org
Thu Jun 1 13:27:54 EDT 2006


This function is really useful but it seems to only take tuples not
ndarrays.   This seems kinda strange.  Does one have to convert the
ndarray into a tuple to use it?  This seems extremely inefficient.  Is
there an efficient way to argsort a 2d array based upon multiple
columns if lexsort is not the correct way to do this?  The only way I
have found to do this is to construct a list of tuples and sort them
using python's list sort.  This is inefficient and convoluted so I was
hoping lexsort would provide a simple solution.

--Tom




More information about the NumPy-Discussion mailing list