I have a numpy master array. Given another array of search values, with repeating elements, I want to produce the indices of these search values in the master array.
Would np.searchsorted work for you ?
np.searchsorted
>>> master = np.array([1,2,3,4,5]) >>> search = np.array([4,2,2,3]) >>> np.searchsorted(master, search) array([3, 1, 1, 2])