[SciPy-User] Extracting common triplet from coordinate lists

Borís BURLE boris.burle at univ-provence.fr
Mon Sep 28 14:07:36 EDT 2009


Thanks very much, that was very helpful !!!

    B.

David Warde-Farley a écrit :
> On 28-Sep-09, at 4:12 AM, Borís BURLE wrote:
>
>> In this example, I would like to extract the triplets (1,4,3) and
>> (3,2,1) since they are common to the three sets. As you can notice, the
>> position of the common triplet is variable. In this example, data are in
>> list, but any code working  on arrays would be ok for me too !!
>
> Easiest way I can think of:
>
> In [36]: set(zip(x1, y1, z1)) & set(zip(x2, y2, z2)) & set(zip(x3, y3, 
> z3))
> Out[36]: set([(1, 4, 3), (3, 2, 1)])
>
> David

-- 
Borís BURLE
Laboratoire de Neurobiologie de la Cognition
CNRS et Université de Provence
tel: (+33) 4 88 57 68 79
fax: (+33) 4 88 57 68 72
web page:  http://www.up.univ-mrs.fr/lnc/ACT/act-fr.html




More information about the SciPy-User mailing list