-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: Enforce deprecation of dropping columns when numeric_only=False in groupby / resample #49665
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
DEPR: Enforce deprecation of dropping columns when numeric_only=False in groupby / resample #49665
Conversation
… in groupby / resample
pandas/core/groupby/generic.py
Outdated
arr_func, ignore_failures=numeric_only is lib.no_default | ||
) | ||
except NotImplementedError as err: | ||
msg = f"{how} is not supported for at least one provided dtype" |
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.
why not just let the original exception surface? wont that include dtype information?
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.
Thanks! That's much better.
Thanks @rhshadrach |
arr_func, ignore_failures=numeric_only is lib.no_default | ||
) | ||
except NotImplementedError as err: | ||
# For NotImplementedError, args[0] is the error message |
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.
is this still the case if it was raised with just raise NotImplementedError
?
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.
Ah - no, it's not. I'll fix in a followup. Thanks.
… in groupby / resample (pandas-dev#49665) * DEPR: Enforce deprecation of dropping columns when numeric_only=False in groupby / resample * Change to TypeError * Better error message
… in groupby / resample (pandas-dev#49665) * DEPR: Enforce deprecation of dropping columns when numeric_only=False in groupby / resample * Change to TypeError * Better error message
… in groupby / resample (pandas-dev#49665) * DEPR: Enforce deprecation of dropping columns when numeric_only=False in groupby / resample * Change to TypeError * Better error message
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Prior to calling the cython code, cummin/cummax/cumsum/cumprod raise NotImplementedError on object dtypes. The Series path intercepts this and raises a TypeError instead. I've implemented the same here
except for DataFrame, we can't readily tell which dtype(s) would fail, so it raises a somewhat vague "at least one dtype" message.