-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Unicode handling in to_latex
. Needs encoding?
#7061
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
Comments
Can pass a StringIO instance to buf, then encode and write this yourself as a workaround. |
Works correctly in python 3 as well. I've got a fix that seems to work for python 2. Changing with open(self.buf, 'w') as f:
write(f, frame, column_format, strcols, longtable) to import codecs
with codecs.open(self.buf, 'wb', encoding=encoding) as f:
write(f, frame, column_format, strcols, longtable) along with adding an encoding kwarg to |
Yes, I'm slowly trying to move to python 3 partially for this reason. That seems reasonable to me. I assumed that the other functions just encoded the unicode/string according to the given The default in |
I just encountered the same problem with pandas 0.17, so I guess the fix has not been included? @TomAugspurger do you intent on making a PR? |
I never got around to submitting a pull request. Feel free to do so if you want! My fix above might work (would need to be tested), but it might be better to tie this in with how |
Good point. On the same vein, I just noticed that the I'll have a look. |
There’s a possibility that we’ll be able to replace some of the
|
Considering this, and your previous remark, and the simplicity of your solution, I'll just implement the latter. But the |
@nbonnotte yes, this just requires a |
closed by #11914 |
I can't seem to get this one to work and
to_latex
doesn't allow a user-specified encoding. I think this might need a look.I have it in unicode, so try that way.
Nope. Ok, so let's encode it as a utf-8 string
Nope. It looks like it's getting coerced back to unicode in formatter._to_str_columns() then tries to write it as ASCII...
The text was updated successfully, but these errors were encountered: