[SciPy-User] Extracting common triplet from coordinate lists

David Warde-Farley dwf at cs.toronto.edu
Mon Sep 28 05:57:47 EDT 2009


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


More information about the SciPy-User mailing list