title: Numpy: find first index of value fast
body: <p>How can I find the index of the first occurrence of a number in a Numpy array?
  Speed is important to me. I am not interested in the following answers because they scan the whole array and don't stop when they find the first occurrence:</p>
  
  <pre><code>itemindex = numpy.where(array==item)[0][0]
  nonzero(array == item)[0][0]
  </code></pre>
  
  <p>Note 1: none of the answers from that question seem relevant <a href="https://stackoverflow.com/questions/432112/python-numpy-array-help-is-there-a-function-to-return-the-index-of-something-in">Is there a Numpy function to return the first index of something in an array?</a></p>
  
  <p>Note 2: using a C-compiled method is preferred to a Python loop.</p>