title: Return top N largest values per group using pandas
body: <p>I am trying to find maximum values in number of series each grouped by name of the column it was extracted from.</p>
  
  <p>I have a dataframe as such:</p>
  
  <pre><code>MASTER      SLAVE       Value
  
  Master_1    Slave_1     657879
  Master_1    Slave_2     34343
  Master_1    Slave_3     453313
  
  Master_2    Slave_1     56667
  Master_2    Slave_2     6879
  Master_2    Slave_3     12333
  Master_2    Slave_4     789
  Master_2    Slave_5     22235
  
  Master_3    Slave_1     65765
  Master_3    Slave_2     23431
  Master_3    Slave_3     445
  Master_3    Slave_4     567
  </code></pre>
  
  <p>I need to find maximum values of first two slaves of each master.</p>
  
  <p>This is so far I've gotten yet:</p>
  
  <pre class="lang-py prettyprint-override"><code>df.groupby('MASTER')['SLAVE'].unique()
  </code></pre>
  
  <p>It output series 'Slaves' values for each 'MASTER':</p>
  
  <pre><code>Master_1    [657879, 34343, 453313]
  Master_2    [56667, 6879, 12333, 789, 22235]
  Master_3    [65765, 23431, 445, 789, 567]
  </code></pre>
  
  <p>But I fail to understand what type of data I'm dealing with after this input. And how I can sort those values.</p>