title: AttributeError: 'numpy.ndarray' object has no attribute 'where'
body: <p>I have a NumPy array such as this:</p>
  
  <pre><code>[ 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
    1  1  1  1  1  1  1  1  1  1  1 -1  1  1  1  1  1  1  1  1  1  1  1  1
    1  1  1  1  1  1  1  1  1  1  1 -1  1  1  1  1  1  1  1  1  1  1  1  1
    1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
    1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1 -1 -1 -1
    1  1  1  1  1  1 -1  1 -1  1  1  1  1  1  1  1  1  1  1  1  1 -1  1 -1
   -1 -1 -1  1  1 -1 -1 -1 -1 -1  1 -1 -1  1  1  1  1  1 -1  1  1  1  1  1
    1  1  1  1  1  1  1 -1 -1  1  1  1  1  1  1  1 -1  1  1  1  1  1  1  1
   -1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1 -1  1
    1 -1 -1  1  1  1  1  1  1]
  </code></pre>
  
  <p>I am trying to access the index of an elements equaling -1 in a np array. I found NumPy has an equivalent to list.index but I keep getting an attribute error:  'numpy.ndarray' object has no attribute 'where'</p>
  
  <p>I saw here <a href="https://stackoverflow.com/questions/432112/is-there-a-numpy-function-to-return-the-first-index-of-something-in-an-array">Is there a NumPy function to return the first index of something in an array?</a> that I should use where, however when I try the following I get the above error:</p>
  
  <pre><code>for pred in outlier_preds:
      if pred == -1:
          index = where(predictions)
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>for pred in outlier_preds:
      if pred == -1:
          index = outlier_preds.where(pred == -1)
          outlier_indecies.append(index)
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>for pred in outlier_preds:
      if pred == -1:
          index = outlier_preds.where(preds)
  </code></pre>
  
  <p>There is obviously an attribute where() but for some reason it isn't working, I guess the way I am trying to use it?</p>
  
  <p>Obviously I can get around it by converting it to a list but I would like to know how to use where correctly if possible</p>