title: Find index of min value in a matrix
body: <p>I've a 2-Dim array containing the residual sum of squares of a given fit (unimportant here).</p>
  
  <pre><code>RSS[i,j] = np.sum((spectrum_theo - sp_exp_int) ** 2)
  </code></pre>
  
  <p>I would like to find the matrix element with the minimum value AND its position (i,j) in the matrix. Find the minimum element is OK:</p>
  
  <pre><code>RSS_min = RSS[RSS != 0].min()
  </code></pre>
  
  <p>but for the index, I've tried:</p>
  
  <pre><code>ij_min = np.where(RSS == RSS_min)
  </code></pre>
  
  <p>which gives me:</p>
  
  <pre><code>ij_min =  (array([3]), array([20]))
  </code></pre>
  
  <p>I would like to obtain instead:</p>
  
  <p>ij_min = (3,20)</p>
  
  <p>If I try :</p>
  
  <pre><code>ij_min = RSS.argmin()
  </code></pre>
  
  <p>I obtain:</p>
  
  <pre><code>ij_min = 0,
  </code></pre>
  
  <p>which is a wrong result.</p>
  
  <p>Does it exist a function, in Scipy or elsewhere, that can do it? I've searched on the web, but I've found answers leading only with 1-Dim arrays, not 2- or N-Dim.</p>
  
  <p>Thanks!</p>