-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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/ENH: Provide full suite of arithmetic (and flex) methods to all NDFrame objects. #5022
Conversation
This could use more work later on, but this is a nightmare to maintain in the interim, so I'd like to put it into pandas. Comments? |
@@ -36,6 +36,52 @@ API changes | |||
an alias of iteritems used to get around ``2to3``'s changes). | |||
(:issue:`4384`, :issue:`4375`, :issue:`4372`) | |||
- ``Series.get`` with negative indexers now returns the same as ``[]`` (:issue:`4390`) | |||
- ``HDFStore`` |
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.
was this a string editing? because its already there
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.
darn it git.
To be clear, basically the only changes in functionality in this PR are:
|
if len(self) != len(other): | ||
raise AssertionError("Operands must be of the same size") | ||
if not isinstance(other, SparseArray): | ||
if not ((len(self) == len(other))): |
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 u keep my change here from the parse-exceptions
PR
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 was one place I made an explicit choice. I'm okay either way (I had this error before) - thought it was helpful to print the lengths with the exception. your call.
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'm just referring to the ugly not ((len(self) == len(other)))
, your error message is much better
ok by me. |
ok here too |
* Abstract all arithmetic methods into core/ops * Normalize arithmetic methods signature (see `ops.add_special_arithmetic_methods` and `ops.add_flex_arithmetic_methods` for signature). * Opt-in more arithmetic operations with numexpr (except for SparsePanel, which has to opt-out because it doesn't respond to `shape`). * BUG: Fix ``_fill_zeros`` call to work even if TypeError (previously was inconsistent). * Add bind method to core/common * Add full range of flex arithmetic methods to all NDFrame/ndarray PandasObjects (except for SparsePanel pow and mod, which only work for scalars) * Add a set of testing methods to check that numexpr was actually used successfully. * Flesh out test cases to include all arithmetic ops + test refactoring * Disable numexpr for sparse objects (they don't work correctly right * now) * Sparse methods aren't moved because they are very specific to sparse (and aren't numexpr accelerated) * Disable r* comparisons for now because they cause test failures * Specifically allow radd in TimeOps for Series * Fixup Series time rops and add a few test cases. * Disable flex r-ops for bools (no good test cases yet...) * TST: Remove tests for TypeErrors in pandas/computation/test_eval that now work after this refactor (because DataFrame now defines more r* methods)
Enable test cases that involve these DateOffsets with `__r*` ops
CLN/ENH: Provide full suite of arithmetic (and flex) methods to all NDFrame objects.
There's a lot of overlap right now, this is the first step to trying to
make this cleaner.
PandasObjects (except for SparsePanel pow and mod, which only work for
scalars)
ops.add_special_arithmetic_methods
andops.add_flex_arithmetic_methods
for signature).SparsePanel, which has to opt-out because it doesn't respond to
shape
)._fill_zeros
call to work even if TypeError (previouslywas inconsistent).
Closes #3765.
Closes #4334.
Closes #4051.
Closes #5033.
Closes #4331.