title: Find value in an array corresponding to position of max in another one
body: <p>I have two arrays</p>
  
  <pre><code>c = [ [1, 2, 3],
        [3, 7, 8],
        [5, 2, 4] ]
  </code></pre>
  
  <p>and </p>
  
  <pre><code>u = [ [3, 7, 8],
        [1, 3, 2],
        [1, 3, 7] ]
  </code></pre>
  
  <p>I want to find the maximum of c for each row, and the corresponding value in u. That would be:</p>
  
  <pre><code>cMax = [3, 8, 5]
  </code></pre>
  
  <p>and </p>
  
  <pre><code>uMax = [8, 2, 1]
  </code></pre>
  
  <p>I have tried</p>
  
  <pre><code>cMax = np.nanmax(c, axis=1)
  cMaxIdx = np.argmax(c, axis=1)
  </code></pre>
  
  <p>which gives</p>
  
  <pre><code>cMax = [3, 8, 5]
  cMaxIdx = [2, 2, 0]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>uCMax = u[:,cMaxIdx]
  </code></pre>
  
  <p>which gives</p>
  
  <pre><code>uCMax = [ [8, 8, 3]
            [2, 2, 1]
            [7, 7, 1] ]
  </code></pre>