-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: Don't intercept NotImplementedError in _cython_transform #49742
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
CLN: Don't intercept NotImplementedError in _cython_transform #49742
Conversation
pandas/core/groupby/generic.py
Outdated
@@ -1362,8 +1362,9 @@ def arr_func(bvalues: ArrayLike) -> ArrayLike: | |||
arr_func, ignore_failures=numeric_only is lib.no_default | |||
) | |||
except NotImplementedError as err: | |||
# For NotImplementedError, args[0] is the error message | |||
raise TypeError(err.args[0]) from err | |||
# For NotImplementedError, args[0] is the error message when available |
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.
im fine with this, but FWIW id just not catch this and let the NotImplementedError bubble up
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.
Sounds good - I'll take that approach here. The only functions in our test that currently raise here are cumsum, cummin, cummax, and cumprod. I'm thinking longer term it'd be better to provide a Python fallback for object dtypes where cumsum (on strings, at least), cummin, and cummax could be successful, and cumprod will then raise the proper TypeError. Does that make sense?
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.
seems reasonable
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.
LGTM
lgtm. is this not user facing at all / worth a whatsnew? |
This was changed from raising NotImplementedError to a TypeError in #49665. So this PR is really just reverting that change. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Ref: #49665 (comment)
The one place in groupby where there is
raise NotImplementedError
is in_reconstruct_ea_result
. This is not hit by tests.cc @jbrockmendel