[Numpy-discussion] Search array in array

Nicola Creati ncreati at inogs.it
Mon Jul 29 08:50:03 EDT 2013


Hello,
I'm wondering if there is a fast way to solve the following problem. I 
have two arrays:

A = [[ 4,  9, 10],
        [ 7,  4, 17],
        [12, 21, 14],
        [12, 24, 11],
        [18, 21,  3],
        [16,  3,  7],
        [17, 21,  5],
        [24,  3, 14]]

B = [[17,  5],
        [14,  21]]

I need to search rows of A that contain elements of each row of B 
regardless of the order of the elements in B. The searched results is: 
[2, 6] .

Thanks.

Nicola

-- 
_____________________________________________________________________
Nicola Creati
Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS
IRI (Ricerca Teconologica e Infrastrutture) Department
B.go Grotta Gigante - Brisciki 42/c
34010 Sgonico - Zgonik (TS) - Italy
Tel. +39-0402140213
Fax  +39-040327307




More information about the NumPy-Discussion mailing list