-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: Add support for tablewise application of style.background_gradient with axis=None #21259
ENH: Add support for tablewise application of style.background_gradient with axis=None #21259
Conversation
Hello @soxofaan! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on July 11, 2018 at 15:48 Hours UTC |
060fd66
to
b1dfa6c
Compare
pandas/io/formats/style.py
Outdated
@@ -901,16 +901,21 @@ def background_gradient(self, cmap='PuBu', low=0, high=0, axis=0, | |||
def _background_gradient(s, cmap='PuBu', low=0, high=0): | |||
"""Color background in a range according to the data.""" | |||
with _mpl(Styler.background_gradient) as (plt, colors): | |||
rng = s.max() - s.min() | |||
min = s.values.min() | |||
max = s.values.max() |
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.
Can you use different names for min
/max
so they don't override the built-in min
/max
functions?
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.
sure, updated commit
b1dfa6c
to
e376312
Compare
Codecov Report
@@ Coverage Diff @@
## master #21259 +/- ##
==========================================
+ Coverage 91.92% 91.92% +<.01%
==========================================
Files 160 160
Lines 49906 49910 +4
==========================================
+ Hits 45875 45879 +4
Misses 4031 4031
Continue to review full report at Codecov.
|
e376312
to
e6f7758
Compare
@jschendel I updated the commit per your request the failing tests/checks are not related to the change as far as I understand, is there something I should do about that? |
you have linting issues: pandas/tests/io/formats/test_style.py:1066:1: E303 too many blank lines (3) |
is it worth adding the OP example here? |
e6f7758
to
5c05bf1
Compare
@jreback thanks, I didn't catch that linting issue warning. Lot of trees in the forest. I think the OP example is good for interactive testing, but overkill for unit testing |
5c05bf1
to
23a4bfb
Compare
(this PR will conflict with #21263 ) |
23a4bfb
to
0f2b688
Compare
0f2b688
to
5322f25
Compare
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.
minor comments. lgtm.
doc/source/whatsnew/v0.24.0.txt
Outdated
@@ -16,7 +16,9 @@ Other Enhancements | |||
- :func:`Series.mode` and :func:`DataFrame.mode` now support the ``dropna`` parameter which can be used to specify whether NaN/NaT values should be considered (:issue:`17534`) | |||
- :func:`to_csv` now supports ``compression`` keyword when a file handle is passed. (:issue:`21227`) | |||
- :meth:`Index.droplevel` is now implemented also for flat indexes, for compatibility with MultiIndex (:issue:`21115`) | |||
|
|||
- Allow elementwise coloring in ``style.background_gradient`` with ``axis=None`` (:issue:`15204`) |
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.
use :class:`pandas.io.formats.style.Styler`
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.
or even better, I'll move it alongside with the changelog entry for PR #21263
5322f25
to
f044cf7
Compare
|
f044cf7
to
d615e90
Compare
😕 now
|
d615e90
to
c39f420
Compare
(rebased on latest master) |
Thanks! |
git diff upstream/master -u -- "*.py" | flake8 --diff