title: Pandas pd.Grouper trouble with sum()
body: <p>After reading and benefiting a lot from Stackoverflow over the last 6 months, now, I come across a problem that I need to ask. Very exciting. </p>
  
  <p>Let me briefly state my problem: </p>
  
  <p>I have a dataframe like this names "trades" (this is trading data from an exchange websocket):</p>
  
  <pre><code>trades.head()
                                  side    price   size
  date            
  2019-12-26 10:20:11.895999908   buy     7210.0  1.0
  2019-12-26 10:20:20.477999926   buy     7210.0  1.0
  2019-12-26 10:20:21.221999884   buy     7210.0  10000.0
  2019-12-26 10:20:23.737999916   sell    7210.0  1.0
  </code></pre>
  
  <p>What I desired was to two things: 
  1 - Arrange data in minutes 
  2-  Grouped that data for "side" and "price" information and get the cumulative "order sizes" for each "price" for any given minute. </p>
  
  <p>You can look at the example below to see what I want to achieve.</p>
  
  <pre><code>trades.head()
  
  date                    side    price   size
  
  2019-12-26 10:20:00     buy     7210.0  22923.0
                          sell    7209.5  25000.0
  2019-12-26 10:21:00     buy     7210.0  79432.0
                          sell    7209.5  5858.0
  2019-12-26 10:22:00     buy     7210.0  76128.0
                          sell    7209.5  12307.0
  2019-12-26 10:23:00     buy     7210.0  4016.0
                          sell    7209.5  25311.0
  2019-12-26 10:26:00     buy     7210.0  100714.0
                          sell    7209.5  1301.0
  </code></pre>
  
  <p>I managed to get this format by using this:</p>
  
  <pre><code>df = trades.groupby(by=[pd.Grouper(key="timestamp", freq="1min"), pd.Grouper(key="side"), pd.Grouper(key="price")]).sum()
  </code></pre>
  
  <p>However, I came across with a problem:</p>
  
  <p>When I try to see the largest order sizes for given side and price with</p>
  
  <pre><code>df.nlargest(3, 'size')
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>date                    side    price   size
  2019-12-31 15:21:00     buy     7172.5  5042595.0
  2019-12-31 17:51:00     buy     7124.5  5027804.0
  2019-12-26 16:32:00     sell    7273.5  4996261.0
  </code></pre>
  
  <p>But when I simply resample data with</p>
  
  <pre><code>pd.DataFrame(trades["size"].resample("1min").sum()).nlargest(3, 'size'):
  </code></pre>
  
  <p>here is what I get</p>
  
  <pre><code>date                    size
  2019-12-27 13:00:00     46486868.0
  2019-12-30 00:13:00     36092742.0
  2019-12-26 19:54:00     32839185.0
  </code></pre>
  
  <p>totally different numbers and when I check the exchange's site I see that the "resample" method gives the correct numbers.</p>
  
  <p>pd.Groupby way doesn't give me the right answer.</p>
  
  <p>How can I get the correct numbers in my desired formatting.</p>
  
  <p>P.S. - Phew! it took nearly 30 minutes for me to write this question. When I was just reading the pages it was seemed too easy. So, I will truly appreciate any comments. Thank you!</p>