I have an array called Y which contains class labels. I want to find all the indexes of Y that match multiple values specified by a list labs.
In this case:
Y = np.array([1,2,3,1,2,3,1,2,3,1,2,3])
labs = [2,3]
How can I do something like np.where(Y == labs) that returns
array([1,2,4,5,7,8,10,11])
I know one possibility is to iterate through the list labs and do element wise comparison. But I am looking for a more pythonic/numpy based solution which avoids looping.