title: Extract row with maximum value in a group pandas dataframe
body: <p>A similar question is asked here:
  <a href="https://stackoverflow.com/questions/15705630/python-how-can-i-get-the-row-which-has-the-max-value-in-goups-making-groupby">Python : Getting the Row which has the max value in groups using groupby</a></p>
  
  <p>However, I just need one record per group even if there are more than one record with maximum value in that group. </p>
  
  <p>In the example below, I need one record for "s2". For me it doesn't matter which one. </p>
  
  <pre><code>&gt;&gt;&gt; df = DataFrame({'Sp':['a','b','c','d','e','f'], 'Mt':['s1', 's1', 's2','s2','s2','s3'], 'Value':[1,2,3,4,5,6], 'count':[3,2,5,10,10,6]})
  &gt;&gt;&gt; df
     Mt Sp  Value  count
  0  s1  a      1      3
  1  s1  b      2      2
  2  s2  c      3      5
  3  s2  d      4     10
  4  s2  e      5     10
  5  s3  f      6      6
  &gt;&gt;&gt; idx = df.groupby(['Mt'])['count'].transform(max) == df['count']
  &gt;&gt;&gt; df[idx]
     Mt Sp  Value  count
  0  s1  a      1      3
  3  s2  d      4     10
  4  s2  e      5     10
  5  s3  f      6      6
  &gt;&gt;&gt; 
  </code></pre>