-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
EHN encoding parameter for to_latex #11914
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
Conversation
df = DataFrame([[u'au\xdfgangen']]) | ||
with tm.ensure_clean('test.tex') as path: | ||
df.to_latex(path, encoding='utf-8') | ||
import codecs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put the import at the top of the module
@nbonnotte what I mean is that I think a This will allow easier refactoring later. |
BTW, this does not solves the missing |
@nbonnotte what was the |
I just meant the |
@@ -302,6 +302,9 @@ Other API Changes | |||
|
|||
- ``.memory_usage`` now includes values in the index, as does memory_usage in ``.info`` (:issue:`11597`) | |||
|
|||
- ``DataFrame.to_latex()`` now supports non-ascii encodings (eg utf-8) in Python 2 with the parameter ``encoding`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue number (7061)
@nbonnotte create another issue for the |
comments, ping when green. |
I've created another issue for Working on the docstring, I realized there was something odd: I was initializing I think it is simpler if the parameter There is still one thing that bothers me: now I'm calling a "private" method ( |
@nbonnotte no that's ok |
I've squashed my commits then. All green! |
def __init__(self, formatter, column_format=None, longtable=False): | ||
self.fmt = formatter | ||
self.frame = self.fmt.frame | ||
self.columns = self.fmt.tr_frame.columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you using these variables? (e.g. .columns
); I'd rather you not define them, or use a cached-property if its more clear (e.g. for .frame
)
pls |
@jreback should be good now ^^ |
merged via 3a832df thanks! |
closes #7061
I'm working on solving issue #7061: currently, with Python 2 it is not possible to use
.to_latex()
when the dataframe contains utf-8 strings. This PR adds anencoding
parameter to make it possible.The work is not completely done though, and I'm making this PR to start a discussion here. In its current state, the PR quickly fixes the issue and provides tests, so it is kind of a minimal PR.
@jreback in the discussion on issue #7061, you made the following suggestion:
I would be glad to work in that direction, but I'm a bit confused by the current organization of the code. This
LatexFormatter
would seem to me to be similar toHTMLFormatter
, which inherits fromTableFormatter
(exactly asDataFrameFormatter
). In that case,DataFrameFormatter
would useLatexFormatter
for.to_latex()
exactly as it usesHTMLFormatter
for.to_html()
. Is that what you had in mind?