title: Numpy 'where' on string
body: <p>I would like to use the numpy.where function on a string array. However, I am unsuccessful in doing so. Can someone please help me figure this out? </p>
  
  <p>For example, when I use <code>numpy.where</code> on the following example I get an error: </p>
  
  <pre><code>import numpy as np
  
  A = ['apple', 'orange', 'apple', 'banana']
  
  arr_index = np.where(A == 'apple',1,0)
  </code></pre>
  
  <p>I get the following: </p>
  
  <pre><code>&gt;&gt;&gt; arr_index
  array(0)
  &gt;&gt;&gt; print A[arr_index]
  &gt;&gt;&gt; apple
  </code></pre>
  
  <p>However, I would like to know the indices in the string array, <code>A</code> where the string <code>'apple'</code> matches. In the above string this happens at 0 and 2. However, the <code>np.where</code> only returns 0 and not 2.  </p>
  
  <p>So, how do I make <code>numpy.where</code> work on strings? Thanks in advance. </p>