title: Getting the n largest values for groups
body: <p>I am looking to isolate the top 2 values per group for the following data. </p>
  
  <pre><code>Brand | Product | Rank
    A   |    P1   |   1000
        |    P2   |   1210
        |    P3   |   2000
        |    P4   |   600
        |    P5   |   756
        |    P6   |   867
    B   |    P1   |   549
        |    P2   |   1572
        |    P3   |   3490
        |    P4   |   2341
        |    P5   |   431
        |    P6   |   321
    C   |    P1   |   421
        |    P2   |   121
        |    P3   |   805
        |    P4   |   1202
        |    P5   |   4032
        |    P6   |   432
  </code></pre>
  
  <p>I want to be able to the top 2 values for each group (A, B, C). </p>
  
  <pre><code>Top_Products = df.nlargest(2, 'Rank')
  </code></pre>
  
  <p>This however only isolates the top 2 products. </p>
  
  <p>Is there a way to get the top 2 products per Brand. </p>
  
  <p>Desired Output:</p>
  
  <pre><code>Brand | Product | Rank
    A   |    P3   |   2000
        |    P2   |   1210
    B   |    P3   |   3490
        |    P4   |   2341
    C   |    P5   |   4032
        |    P4   |   1202
  </code></pre>
  
  <p>Thanks!</p>