Nicola Creati <ncreati <at> inogs.it> writes: > > I need to search rows of A that contain elements of each row of B > regardless of the order of the elements in B. > I don't know how fast this is, but it is fairly short: C = (A[..., np.newaxis, np.newaxis] == B) rows = (C.sum(axis=(1,2,3)) >= B.shape[1]).nonzero()[0]