-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Styler.apply
accept ndarray return with axis=None
for consistency
#39393
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
bug: set_td_classes loop ignored entries bug: tooltips indexing was dropped doc: added documentation for methods
# Conflicts: # doc/source/whatsnew/v1.3.0.rst
this is ready for review. It fixes the functionality and edits the docs where necessary, including some better examples. |
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.
not sure we should change this. why can't the user just wrap the return value inside the apply.
Dont know why this restriction was placed in the first place. If you use The builtin functions always have, for example, logic like this:
I dont really understand the downside to just handling an array function output in all cases for axis. |
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.
ok @attack68 this is ok, yeah consistency is better here. small comments, ping on green.
pandas/io/formats/style.py
Outdated
@@ -894,7 +900,7 @@ def apply( | |||
``func`` should take a Series or DataFrame (depending | |||
on ``axis``), and return an object with the same shape. | |||
Must return a DataFrame with identical index and | |||
column labels when ``axis=None``. | |||
column labels or an ndarray of appropriate shape when ``axis=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.
same shape as input
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.
add versionchanged 1.3
# Conflicts: # doc/source/whatsnew/v1.3.0.rst
33c3124
to
a463a53
Compare
@jreback changes done. mostly green. fails unrelated it seems |
thanks @attack68 |
Styler.apply
withaxis=None
can accept ndarray #39359Also minor edits to docs to extend information and show examples.
cc @TomAugspurger