title: python pandas dataframe groupby or pivot_table
body: <p>Example:</p>
  
  <pre><code>import pandas as pd
  data = {'id':[101,101,101,101,102,102,102,102],
      'day':[1,2,1,2,1,2,1,2],
      'year':[2011,2011,2012,2012,2011,2011,2012,2012],
      'avg':[0.500,0.400,0.300,0.200,0.555,0.455,0.355,0.255],
      'sum':[1, 2, 2, 3, 6, 6, 8, 9],
      'div':[2, 1, 3, 2, 6, 1, 6, 3]}
  df = pd.DataFrame(data)
  df
  
      id  day year    avg     sum div
  0   101 1   2011    0.500   1   2
  1   101 2   2011    0.400   2   1
  2   101 1   2012    0.300   2   3
  3   101 2   2012    0.200   3   2
  4   102 1   2011    0.555   6   6
  5   102 2   2011    0.455   6   1
  6   102 1   2012    0.355   8   6
  7   102 2   2012    0.255   9   3
  </code></pre>
  
  <p>desired output:</p>
  
  <pre><code>    id  sum div 2011_avg    2012_avg    2011_sum    2012_sum    2011_div    2012_div
  0   101 8   8   0.450       0.250       3           5           2           1.5
  1   102 29  16  0.505       0.305       12          17          6           2.0
  </code></pre>
  
  <p>I made several pivot_tables for each column by year and joins multiple times..</p>
  
  <p>Can anyone give me some knowledge to a easier or efficient way to get desired output?</p>