0

I have huge list of int32 numpy 1d arrays. Is there an efficient way to get indexes of rows having non-empty intersection with test array? Basically I'm looking for faster replacement for pythonic expression:

indexes = [
    i for i, n in enumerate(iterable_of_iterables)  # [[1, 2], [2, 3], [4]]
    if set(n).intersection(test_iterable)           # [1, 4]
]                                                   # -> [0, 2]
demon.mhm
  • 469
  • 4
  • 18

0 Answers0