Has anyone any experience of publishing a pandas pivot table to a html page? Its simple to publish a list as a table but i dont know the syntax for a pandas pivot. On the bus now so ill post some code when i get in
Thanks
Has anyone any experience of publishing a pandas pivot table to a html page? Its simple to publish a list as a table but i dont know the syntax for a pandas pivot. On the bus now so ill post some code when i get in
Thanks
A pivot table is nothing else than a DataFrame, so it has the to_html()
method described in the docs here
It will output html code for the table, for example, with this very simple dataframe:
In [1]: df
Out[1]:
A B
0 0 1
1 2 3
In [2]: print df.to_html()
Out[2]:
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>2</td>
<td>3</td>
</tr>
</tbody>
</table>