title: Efficiently combine min/max on different columns of a pandas dataframe
body: <p>I have a pandas dataframe that contains the results of computation and need to:</p>
  
  <ul>
  <li>take the maximum value of a column and for that value find the maximum value of another column</li>
  <li>take the minimum value of a column and for that value find the maximum value of another column</li>
  </ul>
  
  <p>Is there a more efficient way to do it?</p>
  
  <p>Setup
  </p>
  
  <pre><code>metrictuple = namedtuple('metrics', 'prob m1 m2')
  l1 =[metrictuple(0.1, 0.4, 0.04),metrictuple(0.2, 0.4, 0.04),metrictuple(0.4, 0.4, 0.1),metrictuple(0.7, 0.2, 0.3),metrictuple(1.0, 0.1, 0.5)]
  df = pd.DataFrame(l1)
  # df
  #   prob   m1    m2
  #0   0.1  0.4  0.04
  #1   0.2  0.4  0.04
  #2   0.4  0.4  0.10
  #3   0.7  0.2  0.30
  #4   1.0  0.1  0.50
  
  tmp = df.loc[(df.m1.max() == df.m1), ['prob','m1']]
  res1 = tmp.loc[tmp.prob.max() == tmp.prob, :].to_records(index=False)[0]
  #(0.4, 0.4)
  tmp = df.loc[(df.m2.min() == df.m2), ['prob','m2']]
  res2 = tmp.loc[tmp.prob.max() == tmp.prob, :].to_records(index=False)[0]
  #(0.2, 0.04)
  </code></pre>