[Numpy-discussion] Search array in array

Nicola Creati ncreati at inogs.it
Tue Jul 30 02:57:13 EDT 2013


On 07/29/2013 10:27 PM, Gabe Schwartz wrote:
> C = (A[..., np.newaxis, np.newaxis] == B)
> rows = (C.sum(axis=(1,2,3)) >= B.shape[1]).nonzero()[0]
Hello,
thank you, it's not fast but really nice.

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