In a low-level function that is called many times, I need to do the equivalent of python\'s list.index, but with a numpy array. The function needs to return when it finds the f
If your numpy array is 1d array, maybe try like this:
a = np.array([1, 2, 3])
print a.tolist().index(2)
>>> 1
If is not 1d, you could search trough array like:
a = np.array([[1, 2, 3],[2,5,6],[0,0,2]])
print a[0,:].tolist().index(2)
>>> 1
print a[1,:].tolist().index(2)
>>> 0
print a[2,:].tolist().index(2)
>>> 2