Closed
Description
I know that the whitespace doesn't meter in HTML but this is really a strange behaviour:
>>> df = pd.read_html(
'http://en.wikipedia.org/wiki/Vancouver',
match='Municipality', header=0
)[0]
>>> df
0 Country Municipality NaN
1 Ukraine Odessa 1944
2 Japan Yokohama 1965
3 United Kingdom Edinburgh[198][199] 1978
4 China Guangzhou[200] 1985
5 United States Los Angeles 1986
6 South Korea Seoul 2007
>>> df.iat[3, 0]
'China'
>>> df.iat[4, 0]
'United States'
>>> df.iat[5, 1]
'Seoul'
Which is all fine, but if i try to convert it to HTML I get a really funky looking data :)
>>> print(df.to_html(index=False))
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>Country</th>
<th>Municipality</th>
<th>nan</th>
</tr>
</thead>
<tbody>
<tr>
<td> Ukraine</td>
<td> Odessa</td>
<td> 1944</td>
</tr>
<tr>
<td> Japan</td>
<td> Yokohama</td>
<td> 1965</td>
</tr>
<tr>
<td> United Kingdom</td>
<td> Edinburgh[198][199]</td>
<td> 1978</td>
</tr>
<tr>
<td> China</td>
<td> Guangzhou[200]</td>
<td> 1985</td>
</tr>
<tr>
<td> United States</td>
<td> Los Angeles</td>
<td> 1986</td>
</tr>
<tr>
<td> South Korea</td>
<td> Seoul</td>
<td> 2007</td>
</tr>
</tbody>
</table>
And also, if I specify explicitly the classes
why does it always adds the dataframe
class? Shouldn't the classes
override the default dataframe
class?