title: pandas pivot dataframe with multiple groupby
body: <p>I have a pandas dataframe with data like this:</p>
  
  <p>df:</p>
  
  <pre><code>     item   day         time      data  
  0   item_0  2012-12-02  00:00:01  0.81  
  1   item_0  2012-12-02  00:00:02  0.07
  2   item_0  2012-12-03  00:00:00  0.84  
  3   item_1  2012-12-02  00:00:01  0.47
  </code></pre>
  
  <p>The combination of item+day+time are unique</p>
  
  <p>I am trying to transform to:</p>
  
  <pre><code>     item   day         time_0    time_1   time_2  
  0   item_0  2012-12-02  NaN       0.81     0.07
  1   item_0  2012-12-03  0.84      NaN      NaN  
  2   item_1  2012-12-02  NaN       0.47     ... 
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>df_stage_1 = df.groupby(['item','day']).apply(lambda x: x['time'].tolist()).reset_index()
  </code></pre>
  
  <p>the code above produces a list but times are not aligned from 00:00:00 - I could just check the list and add and track the indexes (so can add Nan to value list at these indexes)</p>
  
  <pre><code>df_stage_1 = pd.DataFrame(df_stage_1.tolist(), )
  </code></pre>
  
  <p>the code above gives me a dataframe of (unaligned) time values, which I could align (see above) and append to dataframe created in step above, but I cant work out how to get values for dataframe in correct time aligned columns</p>