-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF/CLN: Use Numpy C Iterator API to unify isnaobj 1D/2D #50658
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
pandas/_libs/missing.pyx
Outdated
assert arr.ndim == 2, "'arr' must be 2-D." | ||
bint is_null | ||
ndarray result = np.empty((<object>arr).shape, dtype=np.uint8) | ||
flatiter it = PyArray_IterNew(arr) |
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 robust to F-major inputs? i think we use the cnp.broadcast pattern for 2D support elsewhere
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.
I think PyArray_IterNew
forces C style iteration.
https://numpy.org/devdocs/reference/c-api/array.html#c.PyArray_IterNew
I'll look to see if I need to add any tests for this.
I'll also give broadcasting a shot.
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.
oh neat. then it may turn out some places where ive used cnp.broadcast may be unnecessary
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 just a merge conflict
|
Thanks @lithomas1 |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.ASV's