-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
ENH: Styler.bar
extended to allow centering about the mean, value or callable
#42301
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.bar
extended to allow centering about the mean, value or callableStyler.bar
extended to allow centering about the mean, value or callable
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 fine. anything need updating in the doc-string?
@@ -2831,3 +2785,166 @@ def _highlight_between( | |||
else np.full(data.shape, True, dtype=bool) | |||
) | |||
return np.where(g_left & l_right, props, "") | |||
|
|||
|
|||
def _bar( |
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.
could consider moving style* things to a separate dir e.g. pandas/io/formats/style/* and then have flexibility to for example move some utilities to own modules. (obviously for future)
have also done the changes to the doc string and added a |
# Conflicts: # doc/source/whatsnew/v1.4.0.rst
# Conflicts: # doc/source/whatsnew/v1.4.0.rst
thanks @attack68 |
This refactors
Styler.bar
to allow more flexible arguments to align bars, and an additional keywordprops
akin to other builtin methods that allow some customisation, demonstrated in the new user guide (image below)All previous tests pass with minor formatting alterations.
As a follow-on I should improve the original testing for this function - it is sporadic and unstructured.