Using the follow python code to generate an HTML table from a pandas DataFrame:
IN:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.zeros((2,2)))
df.to_html()
print(df.to_html())
OUT:
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0.0</td>
<td>0.0</td>
</tr>
<tr>
<th>1</th>
<td>0.0</td>
<td>0.0</td>
</tr>
</tbody>
</table>
Is there an easy way to insert an id
into the table start tag?
So that the start tag looks like this:
<table id="my_table" border="1" class="dataframe">