title: Pandas performance: pivot_table vs groupby
body: <p>I am struggling with performance of pivot_table versus groupby</p>
  
  <p>On one hand I have:</p>
  
  <pre><code>%time df.groupby(['INDEX', 'COLUMN']).agg({'VALUE':['sum','size']}).unstack(level='COLUMN')
  CPU times: user 2.28 s, sys: 29.8 ms, total: 2.31 s
  Wall time: 2.36 s
  </code></pre>
  
  <p>On the other hand I get:</p>
  
  <pre><code>%time pd.pivot_table(df, index='INDEX', columns='COLUMN', values='VALUE', aggfunc=[len, np.sum], fill_value=0)
  CPU times: user 1min 51s, sys: 1.57 s, total: 1min 53s
  Wall time: 1min 54s
  </code></pre>
  
  <p>These are essentially the same things but I get like 60x performance difference. Why is that?</p>