need help pivoting pandas table
<pre><code>print df
             output_time   position
0    2016-01-01 08:00:01      start
1    2016-01-01 08:07:53        end
2    2016-01-01 08:07:54      start
3    2016-01-01 08:09:23        end
4    2016-01-01 08:09:24      start
5    2016-01-01 08:32:51        end
</code></pre>

<p>I need the output as such (with df remaining a dataframe type not series type:</p>

<pre><code>print df
              start                   end
2016-01-01 08:00:01   2016-01-01 08:07:53
2016-01-01 08:07:54   2016-01-01 08:09:23
2016-01-01 08:09:24   2016-01-01 08:32:51
</code></pre>

<p><code>df = df.pivot_table(columns="output_time", values="position")</code> gives the following error:</p>

<blockquote>
  <p>raise DataError('No numeric types to aggregate')
      pandas.core.base.DataError: No numeric types to aggregate</p>
</blockquote>

<p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.pivot.html" rel="nofollow"><code>pivot</code></a> instead of <code>pivot_table</code>:</p>

<pre><code># Perform the pivot.
df = df.pivot(index=df.index//2, columns='position')

# Format the columns.
df.columns = df.columns.droplevel(0).rename(None)
</code></pre>

<p>The resulting output:</p>

<pre><code>                  end               start
0 2016-01-01 08:07:53 2016-01-01 08:00:01
1 2016-01-01 08:09:23 2016-01-01 08:07:54
2 2016-01-01 08:32:51 2016-01-01 08:09:24
</code></pre>

python pandas numpy