title: How to find index of minimum non zero element with numpy?
body: <p>I have a 4x1 array that I want to search for the minimum non zero value and find its index. For example:</p>
  
  <pre><code>theta = array([0,1,2,3]).reshape(4,1)
  </code></pre>
  
  <p>It was suggested in a similar thread to use nonzero() or where(), but when I tried to use that in the way that was suggested, it creates a new array that doesn't have the same indices as the original:</p>
  
  <pre><code>np.argmin(theta[np.nonzero(theta)])
  </code></pre>
  
  <p>gives an index of zero, which clearly isn't right. I think this is because it creates a new array of non zero elements first. I am only interested in the first minimum value if there are duplicates.</p>