-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
POC: Don't special case Python builtin and NumPy functions #53426
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
builtins.max: np.maximum.reduce, | ||
builtins.min: np.minimum.reduce, | ||
} | ||
|
||
_cython_table = { |
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.
Can _cython_table
also ve removed?
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 need to know whether the passed function is a NumPy function (maybe there is a better way to do this?) for backwards compatibility. This is because Series.apply
treats these differently.
|
||
result = df.agg(np.std) | ||
expected = Series({"A": 2.0, "B": 2.0}, dtype=float) | ||
expected = Series({"A": expected_value, "B": expected_value}, dtype=float) |
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.
Different ddof here will be import to communicate in a possible deprecation.
result = df.agg(func, axis=axis) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
|
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.
These tests should probably be testing, eventually for the results of the numpy functions?
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.
Yea, I wasn't sure if this was just testing compatibility between e.g. "sum"
and np.sum
. It could be rewritten to test NumPy functions directly.
With this test removed, we have 1308 tests (counting different parametrizations) that pass a NumPy function into agg/apply/transform (within pandas.core.apply
). 306 of those are in tests.apply
.
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.
Just a few comments because I read it anyway, though this is still in draft mode.
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Closing in favor of #53974 |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This PR is just to demonstrate the impact of #53425 on tests.