Pandas pivot table with mean
<p>I have a pandas data frame, df, that looks like this;</p>

<pre><code>index  New  Old  MAP      Limit  count
1       93   35   54       &gt; 18      1
2      163   93  116       &gt; 18      1
3      134   78   96       &gt; 18      1
4      117   81   93       &gt; 18      1
5      194  108  136       &gt; 18      1
6      125   57   79      &lt;= 18      1
7       66   39   48       &gt; 18      1
8      120   83   95       &gt; 18      1
9      150   98  115       &gt; 18      1
10     149   99  115       &gt; 18      1
11     148   85  106       &gt; 18      1
12      92   55   67      &lt;= 18      1
13      64   24   37       &gt; 18      1
14      84   53   63       &gt; 18      1
15      99   70   79       &gt; 18      1
</code></pre>

<p>I need to create a pivot table that looks like this</p>

<pre><code>Limit   &lt;=18   &gt;18
New      xx1   xx2
Old      xx3   xx4
MAP      xx5   xx6
</code></pre>

<p>where values xx1, xx2, xx3, xx4, xx5, and xx6 are the mean of New, Old and Map for respective Limit.
How can I achieve this?
I tried the following without success.</p>

<pre><code>table = df.pivot_table('count', index=['New', 'Old', 'MAP'], columns=['Limit'], aggfunc='mean')
</code></pre>