Re: sort array, apply rearrangement to second

2010-04-01 Thread Steve Howell
On Mar 31, 1:09 pm, Raymond Hettinger wrote: > On Mar 30, 4:25 pm, s...@sig.for.address (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 th

Re: sort array, apply rearrangement to second

2010-03-31 Thread Raymond Hettinger
On Mar 30, 4:25 pm, s...@sig.for.address (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 m

Re: sort array, apply rearrangement to second

2010-03-31 Thread Steve Holden
Victor Eijkhout wrote: > Robert Kern wrote: > >> second[first.argsort()] > > Really cool. Thanks. > >> Ask numpy questions on the numpy mailing list. > > I will. I thought that this question would have an answer in a generic > python idiom. > > Victor. Not an unreasonable assumption, but it

Re: sort array, apply rearrangement to second

2010-03-31 Thread Robert Kern
On 2010-03-31 13:58 PM, Victor Eijkhout wrote: Robert Kern wrote: second[first.argsort()] Really cool. Thanks. Ask numpy questions on the numpy mailing list. I will. I thought that this question would have an answer in a generic python idiom. When dealing with numpy arrays, the generic

Re: sort array, apply rearrangement to second

2010-03-31 Thread Victor Eijkhout
Robert Kern wrote: > second[first.argsort()] Really cool. Thanks. > Ask numpy questions on the numpy mailing list. I will. I thought that this question would have an answer in a generic python idiom. Victor. -- Victor Eijkhout -- eijkhout at tacc utexas edu -- http://mail.python.org/mailman

Re: sort array, apply rearrangement to second

2010-03-30 Thread Robert Kern
On 2010-03-30 18:25 , 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 n

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 9:59 PM, Chris Colbert wrote: > > > On Tue, Mar 30, 2010 at 7:25 PM, 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 t

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 7:25 PM, 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, bu

Re: sort array, apply rearrangement to second

2010-03-30 Thread MRAB
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

Re: sort array, apply rearrangement to second

2010-03-30 Thread Steve Holden
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 efficien

Re: sort array, apply rearrangement to second

2010-03-30 Thread Alf P. Steinbach
* Victor Eijkhout: 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 leas

sort array, apply rearrangement to second

2010-03-30 Thread Victor Eijkhout
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