Closed
Description
Notice in the html below the second index column's 'a' field is given as <th rowspan="2" valign="top">a</th>
, expanding over what should be an empty cell.
I actually found this using a pivot table, margins=True
, as this creates a row keyed like ('All', '', '')
.
print df = pd.DataFrame({'c1': ['a', 'b'], 'c2': ['a', ''], 'data': [1, 2]}).set_index(['c1', 'c2'])
data
c1 c2
a a 1
b 2
print df.to_html()
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th></th>
<th>data</th>
</tr>
<tr>
<th>c1</th>
<th>c2</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>a</th>
<th rowspan="2" valign="top">a</th>
<td> 1</td>
</tr>
<tr>
<th>b</th>
<td> 2</td>
</tr>
</tbody>
</table>