-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Styler.bar height control #42483
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
# Conflicts: # pandas/tests/io/formats/style/test_align.py
@@ -2911,7 +2922,13 @@ def css_calc(x, left: float, right: float, align: str): | |||
else: | |||
start, end = z_frac, (x - left) / (right - left) | |||
|
|||
return css_bar(start * width, end * width, color) | |||
ret = css_bar(start * width, end * width, color) |
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.
what happens for height / width out of bounds? do we raise, is this tested?
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.
currently still renders, but will get bad results. height
is a css artifact though so bad CSS just means it gets ignored by the browser.
What do you want to do? Leave as is? Raise on out-of-bounds? or auto trim bad values to be in the range?
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 think raising is appropriate (don't have to do here), prob needs a dedicated PR as likely need to audit all of these.
# Conflicts: # pandas/tests/io/formats/style/test_bar.py
can you rebase |
done, note the change to keyword only args. |
thanks, IIRC elsewhere you are going to followon with a check for invalid height? |
I originally thought the issue was too complicated to code for such a small feature, but turns out it was only one or two lines of coding, so I added it in. Quite a nice addition for visualisations I think.