I have two 2D arrays and I am looking to find the most efficient way to find the index in one array of rows present in the other array.
With the help of the following answer I came up with the following code that works but I fell that It can be done more efficiently (I am planning to use it on an array of size 4 million):
import numpy as np
a = np.array([[ 2, 3, 4],
[ 6, 7, 8],
[ 7, 10, 9],
[ 3, 2, 1]])
b = np.array([[ 2, 3, 4],
[ 7, 10, 9]])
index = []
for elem in b:
np.where((elem == a).all(axis=1))
index.append(np.where((elem == a).all(axis=1))[0][0])