title: numpy: what is the logic of the argmin() and argmax() functions?
body: <p>I can not understand the output of <code>argmax</code> and <code>argmin</code> when use with the axis parameter. For example:</p>
  
  <pre><code>&gt;&gt;&gt; a = np.array([[1,2,4,7], [9,88,6,45], [9,76,3,4]])
  &gt;&gt;&gt; a
  array([[ 1,  2,  4,  7],
         [ 9, 88,  6, 45],
         [ 9, 76,  3,  4]])
  &gt;&gt;&gt; a.shape
  (3, 4)
  &gt;&gt;&gt; a.size
  12
  &gt;&gt;&gt; np.argmax(a)
  5
  &gt;&gt;&gt; np.argmax(a,axis=0)
  array([1, 1, 1, 1])
  &gt;&gt;&gt; np.argmax(a,axis=1)
  array([3, 1, 1])
  &gt;&gt;&gt; np.argmin(a)
  0
  &gt;&gt;&gt; np.argmin(a,axis=0)
  array([0, 0, 2, 2])
  &gt;&gt;&gt; np.argmin(a,axis=1)
  array([0, 2, 2])
  </code></pre>
  
  <p>As you can see, the maximum value is the point (1,1) and the minimum one is the point (0,0). So in my logic when I run:</p>
  
  <ul>
  <li><code>np.argmin(a,axis=0)</code> I expected <code>array([0,0,0,0])</code> </li>
  <li><code>np.argmin(a,axis=1)</code> I expected <code>array([0,0,0])</code> </li>
  <li><code>np.argmax(a,axis=0)</code> I expected <code>array([1,1,1,1])</code> </li>
  <li><code>np.argmax(a,axis=1)</code> I expected <code>array([1,1,1])</code> </li>
  </ul>
  
  <p>What is wrong with my understanding of things?</p>