sort array, apply rearrangement to second

MRAB python at mrabarnett.plus.com
Tue Mar 30 20:13:16 EDT 2010


Victor Eijkhout wrote:
> I have two arrays, made with numpy. The first one has values that I want
> to use as sorting keys; the second one needs to be sorted by those keys.
> Obviously I could turn them into a dictionary of pairs and sort by the
> first member, but I think that's not very efficient, at least in space,
> and this needs to be done as efficiently as possible.
>> I could use a hand.
>You could sort a list of the indices, using the first array to provide
the keys.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /