-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
ENH: styler.render.repr
option
#43180
Conversation
# Conflicts: # pandas/io/formats/style.py
styler.render.repr
option to allow latex reprstyler.render.repr
option
@@ -214,6 +214,8 @@ def _repr_html_(self) -> str: | |||
""" |
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.
IIRC aren't we supposed to have a _repr_latex_
?
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.
I don't know. See if you prefer the new pattern, simple change.
# Conflicts: # doc/source/whatsnew/v1.4.0.rst
pandas/io/formats/style.py
Outdated
""" | ||
if get_option("styler.render.repr") == "latex": |
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.
do we actually still need this? or is this something controlled by the notebook itself?
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.
I tried to look this up, and I may be wrong but I think Notebook uses _repr_latex_
when converting the notebook to other formats, so it is useful.
When _repr_html_
and _repr_latex
are present the notebook still renders the html version in browser. And I can't find docs on native iPython how to configure it to use the other. So the pandas
options is userfriendly override (per issue)
# Conflicts: # doc/source/whatsnew/v1.4.0.rst
Have refactored this. This is the best, most generic pattern I think. When a |
# Conflicts: # doc/source/whatsnew/v1.4.0.rst
thanks I left the display issue open but xref |
def _repr_latex_(self) -> str: | ||
if get_option("styler.render.repr") == "latex": | ||
return self.to_latex() | ||
return None |
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.
@attack68 i think this is causing the mypy failures on CI
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.
will take a look
offers option switching between "html" and "latex" output.
adds items to #41395.
also xref #39911 (technically after DataFrame.to_html is deprecated)
update to styler user guide as follow-on after all options are merged.