-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
CLN: refactor Styler._translate
into composite translate functions
#40898
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
…_styler # Conflicts: # pandas/io/formats/style.py
# Conflicts: # pandas/io/formats/style.py # pandas/io/formats/style_render.py
is there a |
No because the html element It might be useful for easily adding styling of a |
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.
looks good a question
"class": "blank col0", | ||
"type": "th", | ||
"value": self.blank_value, | ||
"is_visible": True, |
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.
so these are just additional attributes that currently are defaulted?
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.
yes the new _element
function outputs 5 dict keys by default for each cell.
Previously almost all cells needed these 5 and a few only had 3 keys like column header cells. There is no harm adding them, and actually might make future dev easier, for example a hide_headers()
method to complement the hide_index
method can hook into the is_visible
additional key.
thanks @attack68 |
This composites
Styler._translate()
into:where the
_translate_header()
and_translate_body()
methods are given some documentation explaining what they are building. The code is not fundamentally changed, but variable names are renamed to add clarity to match the documentation and loop comprehensions replacefor loops
where possible.Some tests are minimally altered since the generic
_element
method now returns more dict keys for some elements.