[Numpy-discussion] is there a sortrows
josef.pktd at gmail.com
josef.pktd at gmail.com
Sun Dec 21 22:19:37 EST 2008
>
> I may miss something obvious, but why are you using lexsort at all ? At
> leat, the first example is easily achieved with sort(x, axis=0) - but
> maybe you have more complicated examples in mind where you need actual
> lexical sort:
>
> David
>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
>>> arr
array([[ 1, 14],
[ 4, 12],
[ 3, 11],
[ 2, 14]])
>>> np.sort(arr,axis=0)
array([[ 1, 11],
[ 2, 12],
[ 3, 14],
[ 4, 14]])
Josef
More information about the NumPy-Discussion
mailing list