-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Support axis=None in all reductions #21597
Comments
@TomAugspurger @gfyoung , I am interested in this issue and would like to help. But could you guys guide me on how to display these |
@uds5501 : Perhaps this will help? import pandas.util.testing as tm
import warnings
def f():
warnings.warn("This is a deprecation warning", DeprecationWarning)
def test_f():
# Might need to also pass in `check_stacklevel=False`.
with tm.assert_produces_warning(DeprecationWarning):
f() |
@gfyoung Thanks for the help! |
@uds5501 : Describe (briefly) how the behavior would change in the message. |
@gfyoung Alright sure, would submit a PR soon 😄 |
@gfyoung I had one more query regarding this. If I am not wrong, we call Lines 9551 to 9571 in 1a23779
or make separate files for the same like these? pandas/pandas/core/categorical.py Lines 1 to 8 in 83e95e0
A little guidance would be appreciated! |
IINM, you should add it to cc @jreback |
FYI @uds5501, this is a rather large change that needs discussion first. If you're interested in working on it, then by all means, but you might want to wait for feedback from other maintainers before diving into it. |
@TomAugspurger Sure sir! I have not yet begun either and conclusive discussions from maintainers who have better context regarding this are always welcome! |
deprecation PR is #45072 |
@jbrockmendel if you can add this to the do-it-in-2.0 list |
Since the deprecation portion of this issue has been handled, I'm removing the deprecate label as it is now just an enhancement. I believe the enhancement portion still needs to be implemented. |
After #50593, axis=None support is still needed for sum, prod, var, std, sem |
Hi @mroeschke , I would love to contribute to this issue. Can I work on implementing the remaining ops? |
We suggest contributors start with an issue with the "good first issue" tag |
Ok, I'll start with some good first issue then. Thanks! |
It looks like the remaining reductions didn't have the axis=None behavior deprecated, so we'll need to do a deprecation cycle and do the change in 3.0 |
#21486 is implementing support for
axis=None
for compatibility with NumPy 1.15'sall
/any
.The basic idea is to have
df.op(axis=None)
be the same asnp.op(df, axis=None)
for reductions likesum
,mean
, etc.Getting there poses a backwards-compatibility challenge. Currently for some reduction functions like
np.sum
we interpretaxis=None
asThe best I option I see is to just warn that the behavior will change in the future, without providing a way to achieve the behavior today. Then users can update things like
np.sum(df)
tonp.sum(df, axis=0)
. In a later version we'll make the actual change to interpretaxis=None
like NumPy.The text was updated successfully, but these errors were encountered: