I have two 1D arrays, x & y, one smaller than the other. I\'m trying to find the index of every element of y in x.
I\'ve found two naive ways to do this, the fir
I want to suggest one-line solution:
indices = np.where(np.in1d(x, y))[0]
The result is an array with indices for x array which corresponds to elements from y which were found in x.
One can use it without numpy.where if needs.