-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
DEPR: Replacing builtin and NumPy funcs in agg/apply/transform #53974
Conversation
func: Callable, | ||
alias: str, | ||
) -> None: | ||
if alias.startswith("np."): |
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.
Will this warn correctly is a user passes numpy.sum
or builtins.sum
?
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.
Yes - we use lookups in _builtin_table_alias
and _cython_table
to identify the function the user passes, so it is independent of any binding (e.g numpy.sum
vs np.sum
). The alias
here arises from the values in these two dictionaries, and so must either start with np.
or just be the op name (e.g. "sum")
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, but we will report that pandas is using e.g. np.sum
regardless of how the user imports NumPy. So the warning will be emitted under the correct circumstances, but the message might not align with how they import. I think the message is still clear though.
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.
Okay. Yeah I think the message is clear enough despite how the user imports numpy
Thanks @rhshadrach |
…s-dev#53974) * DEPR: Replacing builtin and NumPy funcs in agg/apply/transform * mypy fixup
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.