title: pandas pivot table to data frame
body: <p>I have a dataframe (df) that looks like this:</p>
  
  <pre><code>+---------+-------+------------+----------+
  | subject | pills |    date    | strength |
  +---------+-------+------------+----------+
  |       1 |     4 | 10/10/2012 |      250 |
  |       1 |     4 | 10/11/2012 |      250 |
  |       1 |     2 | 10/12/2012 |      500 |
  |       2 |     1 | 1/6/2014   |     1000 |
  |       2 |     1 | 1/7/2014   |      250 |
  |       2 |     1 | 1/7/2014   |      500 |
  |       2 |     3 | 1/8/2014   |      250 |
  +---------+-------+------------+----------+
  </code></pre>
  
  <p>When I use reshape in R, I get what I want: </p>
  
  <pre><code>reshape(df, idvar = c("subject","date"), timevar = 'strength', direction = "wide")
  
  +---------+------------+--------------+--------------+---------------+
  | subject |    date    | strength.250 | strength.500 | strength.1000 |
  +---------+------------+--------------+--------------+---------------+
  |       1 | 10/10/2012 | 4            | NA           | NA            |
  |       1 | 10/11/2012 | 4            | NA           | NA            |
  |       1 | 10/12/2012 | NA           | 2            | NA            |
  |       2 | 1/6/2014   | NA           | NA           | 1             |
  |       2 | 1/7/2014   | 1            | 1            | NA            |
  |       2 | 1/8/2014   | 3            | NA           | NA            |
  +---------+------------+--------------+--------------+---------------+
  </code></pre>
  
  <p>Using pandas:</p>
  
  <pre><code>df.pivot_table(df, index=['subject','date'],columns='strength')
  
  +---------+------------+-------+----+-----+
  |         |            | pills            |
  +---------+------------+-------+----+-----+
  |         | strength   | 250   | 500| 1000|
  +---------+------------+-------+----+-----+
  | subject | date       |       |    |     |
  +---------+------------+-------+----+-----+
  | 1       | 10/10/2012 | 4     | NA | NA  |
  |         | 10/11/2012 | 4     | NA | NA  |
  |         | 10/12/2012 | NA    | 2  | NA  |
  +---------+------------+-------+----+-----+
  | 2       | 1/6/2014   | NA    | NA | 1   |
  |         | 1/7/2014   | 1     | 1  | NA  |
  |         | 1/8/2014   | 3     | NA | NA  |
  +---------+------------+-------+----+-----+
  </code></pre>
  
  <p>How do I get exactly the same output as in R with pandas? I only want 1 header.</p>