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

Closed
lodagro opened this issue Mar 9, 2012 · 2 comments
Closed

DataFrame.to_html encoding #891

lodagro opened this issue Mar 9, 2012 · 2 comments
Labels
Milestone

Comments

@lodagro
Copy link
Contributor

lodagro commented Mar 9, 2012

see also mailing list

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

In [35]: df
Out[35]:
   A
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'
@lodagro
Copy link
Contributor Author

lodagro 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 as completed in 3b8a192 Mar 15, 2012
@wesm
Copy link
Member

wesm 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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants