title: Understanding NumPy's nonzero function
body: <p>I am trying to understand numpy's <code>nonzero</code> function. The following is an example application:</p>
  
  <pre><code>import numpy
  arr = numpy.array([[1,0],[1,1]])
  arr.nonzero()
  --&gt; (array([0, 1, 1]), array([0, 0, 1]))
  </code></pre>
  
  <p>I can see that because <code>arr</code> is 2-D, the output of <code>nonzero()</code> is a 2-tuple. However, I do not understand why the number of indices in each element of the tuple exceeds the number of rows/columns of the array. I can see that</p>
  
  <pre><code>arr[arr.nonzero()]
  --&gt; array([1, 1, 1])
  </code></pre>
  
  <p>But how...?</p>