Use itertools.product, to avoid nested loops:
[x for x,y in itertools.product(a,b) if np.array_equal(x,y)]There is also a hint on StackOverflow how to make a Cartesian product with numpy:
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!