-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: masked mean unnecessarily overflowing #48378
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
Ah, nice, this is possible now because we require numpy >= 1.20 (the
Yeah, I am not really sure why historically sum, prod, etc are methods, while mean is only handled inside |
Yes, numpy now supports this in every version we need. Ok great, confused me a little bit too |
Added as method |
pandas/tests/extension/base/dim2.py
Outdated
@@ -191,7 +192,11 @@ def test_reductions_2d_axis0(self, data, method): | |||
kwargs["ddof"] = 0 | |||
|
|||
try: | |||
result = getattr(arr2d, method)(axis=0, **kwargs) | |||
if method == "mean": |
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.
We have 2 all NA rows in our array that causes numpy to raise a RuntimeWarning with axis=0. Mean raised previously, so dtype was not checked below
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 good!
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Do we want to add mean to the Masked Array interface (I would say yes, but want to check anyway)? This would simplify things a bit.
cc @jorisvandenbossche