sort array, apply rearrangement to second

Chris Colbert sccolbert at gmail.com
Wed Mar 31 04:11:41 CEST 2010


On Tue, Mar 30, 2010 at 9:59 PM, Chris Colbert <sccolbert at gmail.com> wrote:

>
>
> On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout <see at sig.for.address>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.
>>
>> Victor.
>> --
>> Victor Eijkhout -- eijkhout at tacc utexas edu
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
> I'm not quite sure what you are asking, but there is probably an efficient
> way to do it in pure numpy. You can either post an example of what you want
> here, or better, take it to the NumPy mailing list and I will help you
> there.
>
>
This seems to be what you want:

http://stackoverflow.com/questions/1903462/how-can-i-zip-sort-parallel-numpy-arrays
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100330/7e7ae1af/attachment.html>


More information about the Python-list mailing list