Is there a NumPy function to return the first index of something in an array?
Yes, given an array, array, and a value, item to search for, you can use np.where as: The result is a tuple with first all the row indices, then all the column indices. For example, if an array is two dimensions and it contained your item at two locations then would be equal to your item and so would be: