-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG/TST/REF: Datetimelike Arithmetic Methods #23215
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 1 commit
dc2280f
37728ff
15ad0a6
94f1745
bf5e2fb
3bdf104
982ea30
d046038
a0c1a85
33d82b3
8a7c249
8e57fd8
b932121
9f3b18d
7a8232e
a743f74
0693196
29d91af
af4872e
6707032
18ef26d
60f7f8d
9372423
2a6268e
777f4d9
ee885c8
5f231b2
0214a9e
fbee9f5
f7cf3d9
d799d8e
82df39c
8cf614b
a45734a
fb007cb
1d3fd48
aecfef7
dade955
a6eb01c
acf1f74
e89e3ef
d306277
f6e4073
9146a72
4e4b9ed
f35b3b6
87e07ef
343ee30
0466b9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -745,6 +745,15 @@ def _add_offset(self, other): | |
return type(self)(result, freq=self.freq) | ||
|
||
def _add_delta_td(self, other): | ||
""" | ||
Parameters | ||
---------- | ||
other : timedelta, Tick, np.timedelta64 | ||
|
||
Returns | ||
------- | ||
result : ndarray[int64] | ||
""" | ||
assert isinstance(self.freq, Tick) # checked by calling function | ||
assert isinstance(other, (timedelta, np.timedelta64, Tick)) | ||
|
||
|
@@ -757,10 +766,19 @@ def _add_delta_td(self, other): | |
return ordinals | ||
|
||
def _add_delta_tdi(self, 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. The superclass version seems to return integers, but this an actual PeriodArray? Can you add a comment indicating the types? 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.
Both this and the superclass version return i8 array. The superclass has a brief docstring to that effect. 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. Can you then add a comment on this function indicating the types? That really makes it easier to read through this code But, to my original question: this function uses 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. Good catch, I must have lost track of this somewhere in the rebase process. Fixed to correctly return an i8 array, and brief docstrings added indicating types. |
||
""" | ||
Parameters | ||
---------- | ||
other : TimedeltaArray or ndarray[timedelta64] | ||
|
||
Returns | ||
------- | ||
result : ndarray[int64] | ||
""" | ||
assert isinstance(self.freq, Tick) # checked by calling function | ||
|
||
delta = self._check_timedeltalike_freq_compat(other) | ||
return self._addsub_int_array(delta, operator.add) | ||
return self._addsub_int_array(delta, operator.add).asi8 | ||
|
||
def _add_delta(self, 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 you rename this to _add_timedelta? (or _add_delta_timedelta)