We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78479a7 commit 8b70342Copy full SHA for 8b70342
pandas/_libs/tslibs/offsets.pyx
@@ -1221,12 +1221,12 @@ cdef class RelativeDeltaOffset(BaseOffset):
1221
# perform calculation in UTC
1222
other = other.replace(tzinfo=None)
1223
1224
- if hasattr(self, "nanoseconds"):
1225
- td_nano = Timedelta(nanoseconds=self.nanoseconds)
1226
- else:
1227
- td_nano = Timedelta(other_nanos)
+ other = other + (self._offset * self.n)
1228
1229
- other = other + ((self._offset + td_nano) * self.n)
+ if hasattr(self, "nanoseconds"):
+ other = self.n * Timedelta(nanoseconds=self.nanoseconds) + other
+ if other_nanos != 0:
+ other = Timedelta(nanoseconds=other_nanos) + other
1230
1231
if other_nanos != 0:
1232
other = Timedelta(nanoseconds=other_nanos) + other
0 commit comments