I have a large numpy array ( dtype=int ) and a set of numbers that I would like to find in this array, for example,
import numpy as np values = np.array([1, 2, 3, 1, 2, 4, 5, 6, 3, 2, 1]) searchvals = [3, 1]
The result array does not need to be sorted.
Speed โโis a problem, and since both values and searchvals can be large,
for searchval in searchvals: np.where(values == searchval)[0]
Don't cut it.
Any clues?
source share