Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-23 Thread Shall, Sydney via Tutor
On 23/09/2018 13:04, Peter Otten wrote: Peter Otten wrote: Maybe you could sort the already-sorted property_b again, with some random offset: import itertools def wiggled(items, sigma): ... counter = itertools.count() ... def key(item): return random.gauss(next(counter), sigma) ...

Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-23 Thread Shall, Sydney via Tutor
On 23/09/2018 10:42, Peter Otten wrote: Shall, Sydney via Tutor wrote: What I want is the following. I have: property_a = [1, 6, 2, 4] property_b = [62, 73, 31 102] Result should approximately be: property_b = [31, 102, 62, 73] That is both lists change in value in exactly the same order

Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-23 Thread Peter Otten
Peter Otten wrote: > Maybe you could sort the already-sorted property_b again, with some random > offset: > import itertools def wiggled(items, sigma): > ... counter = itertools.count() > ... def key(item): return random.gauss(next(counter), sigma) > ... return sorted(items,

Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-23 Thread Peter Otten
Shall, Sydney via Tutor wrote: > What I want is the following. > > I have: > > property_a = [1, 6, 2, 4] > > property_b = [62, 73, 31 102] > > Result should approximately be: > > property_b = [31, 102, 62, 73] > > That is both lists change in value in exactly the same order. > > Now, this is e

Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-23 Thread Shall, Sydney via Tutor
On 21/09/2018 00:01, Oscar Benjamin wrote: Sydney wrote and Alan forwarded: I have, I suspect, an elementary problem that I am too inexperienced to resolve. I have two numpy arrays, each representing the values of a specific property of a set of cells. Now, I want to associate the two values

Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-20 Thread Oscar Benjamin
Sydney wrote and Alan forwarded: > > I have, I suspect, an elementary problem that I am too inexperienced to > resolve. > > I have two numpy arrays, each representing the values of a specific > property of a set of cells. > > Now, I want to associate the two values for each cell, that is for each