-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fix arithmetic errors with timedelta64 dtypes #22390
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
Changes from 12 commits
05b2c50
6dbb2e6
8c3df15
a7502ea
ef14164
6b02691
b856744
c493b23
000e6df
19a18ee
6bd5d0e
16e0cfe
40463a6
cdfb3bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
from pandas.core.dtypes.common import ( | ||
is_integer, | ||
is_scalar, | ||
is_timedelta64_dtype, | ||
is_int64_dtype) | ||
from pandas.core.dtypes.generic import ABCSeries, ABCTimedeltaIndex | ||
|
||
|
@@ -596,6 +597,9 @@ def _evaluate_numeric_binop(self, other): | |
# GH#19333 is_integer evaluated True on timedelta64, | ||
# so we need to catch these explicitly | ||
return op(self._int64index, other) | ||
elif is_timedelta64_dtype(other): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't the fall thru raise TypeError? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t understand the question There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. your comment is at odds with the checking i think. pls revise comments and/or checks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment below this line |
||
# Must be an np.ndarray; GH#22390 | ||
return op(self._int64index, other) | ||
|
||
other = self._validate_for_numeric_binop(other, op) | ||
attrs = self._get_attributes_dict() | ||
|
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 you split out to a timedelta bug section (as this is getting kind of long)?
can be in a future 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.
Sounds good
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 we now have a separate section?