Find all indexes of a number in a list using numpy.array
import numpy as np #numpy array of list values values = np.array([1,4,7,1,9,1,10,1]) #number to search searchNum = 1 #returns a list of where 1 is found in the list to foundIndexes foundIndexes = np.where(values == searchNum)[0] #print the results print(foundIndexes)
Comments