Is there a nice way in numpy to get element-wise indexes of where each element in array1 is in array2?
An example:
array1 = np.array([1, 3, 4])
array2 = np.arange(-2, 5, 1, dtype=np.int)
np.where(array1[0] == array2)
# (array([3]),)
np.where(array1[1] == array2)
# (array([5]),)
np.where(array1[2] == array2)
# (array([6]),)
I would like to do
np.where(array1 == array2)
# (array([3 5 6]),)
Is something like this possible? We are guaranteed that all entries in array1 can be found in array2.