-
Notifications
You must be signed in to change notification settings - Fork 882
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
Consolidate binary ops into Frame
#9357
Conversation
Codecov Report
@@ Coverage Diff @@
## branch-21.12 #9357 +/- ##
================================================
- Coverage 10.79% 10.77% -0.02%
================================================
Files 116 116
Lines 18869 19444 +575
================================================
+ Hits 2036 2096 +60
- Misses 16833 17348 +515
Continue to review full report at Codecov.
|
@isVoid The description probably needs an update, after we made those changes Friday night we're no longer making use of |
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.
One minor suggestion for improving the docstrings, otherwise LGTM.
Co-authored-by: Vyas Ramasubramani <vyas.ramasubramani@gmail.com>
Co-authored-by: GALI PREM SAGAR <sagarprem75@gmail.com>
rerun tests |
python/cudf/cudf/core/series.py
Outdated
|
||
# The above has wrapped binary op function from `Frame` with `wrapper`, | ||
# copied module level attributes to wrapper (`__docs__` etc.) and set | ||
# `__wrapped__` attribute of `wrapper` to `Frame` binop. Since this wrapper |
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.
This comment is out of date, now that we set __signature__
instead.
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.
Well actually it's not out of date. @functools.wraps
still sets the __wrapped__
attribute of wrapper
to wrapped_func
, and this makes the signature mismatches with the actual parameter list of wrapper
, which is why we need to set the __signature__
attr below. I updated the docs with some explanation of cpython behavior here to hopefully make it a bit clearer to understand.
@gpucibot merge |
This PR is a follow-up to #9357 that consolidates the comparison binops (eq, ne, lt, le, gt, ge) into Frame, enabling their use on DataFrame objects as well as Series. Note that pandas DataFrames do not support the fill_value parameter for these operations (unlike other binop functions), so we could choose to disable it for ours as well but I have not done so at present (I don't see a particularly strong reason to lean either way). Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - https://github.com/brandon-b-miller URL: #9542
…string (#10576) This PR moves all the binary operation methods such as `Frame.add` into `IndexedFrame`. This removes these methods from `Index` objects to match pandas, where Index objects do not have these methods. I have also consolidated the docstrings for these methods using a single template and our `docutils`. Note that this is technically a breaking change that I am implementing without a deprecation cycle; however, I feel comfortable doing so because these methods were introduced incidentally in #9357 and #9542 into 21.12, so just a couple of releases ago, and since they are not pandas APIs I doubt that they have made significant penetration into user workflows. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - GALI PREM SAGAR (https://github.com/galipremsagar) URL: #10576
Partially solves #9038
This PR moves binary ops from
Series
andDataFrame
intoFrame
to reduce duplications. Because the arguments takes a different order inseries.py
anddataframe.py
resort tofunctools.wraps
to reorder the arguments while keeping the docstrings the same.