Python List index()
The index() method searches an element in the list and returns its index.
In simple terms, the index() method finds the given element in a list and returns its position.
If the same element is present more than once, the method returns the index of the first occurrence of the element.
for array
numpy.nonzero(a)[source]
Return the indices of the elements that are non-zero.
>>> t = array([1, 1, 1, 2, 2, 3, 8, 3, 8, 8])
>>> nonzero(t == 8)
(array([6, 8, 9]),)
>>> nonzero(t == 8)[0][0]
6