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

Shall, Sydney sydney.shall at kcl.ac.uk
Sun Sep 23 08:08:42 EDT 2018


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)
>> ...     return sorted(items, key=key)
>> ...
> 
> One more example:
> 
>>>> s = """\
> ... But my actual scientific problem requires that the correlation should be
> ... only approximate and I do not know how close to to a perfect correlation
> ... it should be. So, I need to introduce some lack of good correlation when
> ... I set up the correlation. How to do that is my problem.
> ... """
>>>> print(textwrap.fill(" ".join(wiggled(s.split(), 2))))
> But actual my scientific the requires that problem should only
> correlation approximate be and not do I know how close to a perfect to
> correlation should it So, be. I to lack need some introduce
> correlation I of good when set correlation. up How to the that do
> problem. is my
> 
> :)
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Ftutor&data=01%7C01%7Csydney.shall%40kcl.ac.uk%7C185332cee28f49ed465108d6214ce8ab%7C8370cf1416f34c16b83c724071654356%7C0&sdata=GBAb%2FdY2zrBqSwOl33ejT%2BzzknQx5RYNXsNEqZQXCX4%3D&reserved=0
> 
Thanks. Most useful.

Sydney

-- 

_________

Professor Sydney Shall
Department of Haematology/Oncology
Phone: +(0)2078489200
E-Mail: sydney.shall
[Correspondents outside the College should add @kcl.ac.uk]


More information about the Tutor mailing list