title: Apply a For loop in with a multiple GroupBy and nlargest
body: <p>I'm trying to create a function that will iterate through a date_id column in a dataframe and create a group for each 6 sequential values and sum the values in the 'value' column, then also return the max value form each group of six along with the result.</p>
  <pre><code>date_id     item_id value
  0   1828    32      1180727.00
  1   1828    43      944937.00
  2   1828    40      806681.00
  3   1828    42      721810.02
  4   1828    36      567950.00
  5   1828    45      545306.38
  6   1828    26      480506.00
  7   1828    53      375788.00
  8   1828    37      236000.00
  9   1828    38      234780.00
  10  1828    21      208998.47
  11  1828    41      135000.00
  12  1797    39      63420.00
  13  1828    28      24410.00
  14  1462    52      0.00
  15  1493    16      0.00
  16  1493    17      0.00
  17  1493    18      0.00
  18  1493    15      0.00
  19  1462    53      0.00
  20  1462    47      0.00
  21  1462    51      0.00
  22  1462    50      0.00
  23  1462    49      0.00
  24  1462    45      0.00
  </code></pre>
  <p>The desired output for each item_id would be</p>
  <pre><code>    date_id                             item_id    value
  0   max value from each date group      36         sum of all values in each date grouping
  </code></pre>
  <p>I have tried using a lambda</p>
  <pre><code>df_rslt = df.groupby('date_id')['value'].apply(lambda grp: grp.nlargest(6).sum())
  </code></pre>
  <p>but then quickly realized this will only return one result.</p>
  <p>I then tried something like this in a for loop, but it got nowhere</p>
  <pre><code>grp_data = df.groupby(['date_id','item_id']) 
                 .aggregate({'value':np.sum})
  
  df_rslt = grp_data.groupby('date_id')
               .apply(lambda x: x.nlargest(6,'value'))
               .reset_index(level=0, drop=True)
  </code></pre>