ENH: to_html improvement · Issue #4987 · pandas-dev/pandas (original) (raw)

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))

Country Municipality nan
Ukraine Odessa 1944
Japan Yokohama 1965
United Kingdom Edinburgh[198][199] 1978
China Guangzhou[200] 1985
United States Los Angeles 1986
South Korea Seoul 2007

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?