Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataFrame.to_html encoding #891

lodagro opened this issue Mar 9, 2012 · 2 comments


None yet
2 participants
Copy link

commented Mar 9, 2012

see also mailing list

In [34]: df = pandas.DataFrame({'A': [u'\u03c3']})

In [35]: df
0  σ

In [36]: print df.to_html()
UnicodeEncodeError                        Traceback (most recent call last)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u03c3' in position 1: ordinal not in range(128)

In [37]:  

further more from the thread:

... I wanted to spot as well that
force_unicode is in the doc but is not available.
TypeError: to_html() got an unexpected keyword argument 'force_unicode'

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2012

@wesm Had a quick look at this.

Currently DataFrame.to_string() and DataFrame.to_html() have the same docstring (through Appender decorator), except for bold_rows. However to_html() misses justify and force_unicode arguments. It probably makes sense for html not to add the force_unicode argument and always use unicode.

By the way bold_rows=True also makes the column labels bold.

@wesm wesm closed this in 3b8a192 Mar 15, 2012


This comment has been minimized.

Copy link

commented Mar 15, 2012

@lodagro appear to have gotten this one. I think the headers always come through as bold via <th> but I could be wrong. I was doing a bunch of other unicode cleanup / fixes in #795 also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.