You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am now reasonably confident that WeekOfMonth.apply and LastWeekOfMonth.apply both have a bug caused by using self.getOffsetOfMonth(dt) instead of `self._get_offset_day(dt)
>>> offset = pd.offsets.WeekOfMonth(n=-2, week=2, weekday=3)
>>> ts = pd.Timestamp('2017-12-21 19:32:49.533991002')
>>> offset.onOffset(ts)
True
>>> (ts + offset) - offset == ts # should be the same as offset.onOffset(ts)
False
>>> ts + offset
Timestamp('2017-11-16 19:32:49.533991002')
But given that offset.onOffset(ts) is True, we would expect ts + offset to move back by 2 months, not 1.
Surfacing this bug requires timestamps with non-zero nanos and n<0. I expect there are other cases that would surface with tzaware timestamps.
Not that hard to fix; I'd like to get #18762 in first to avoid merge conflicts.
The text was updated successfully, but these errors were encountered:
Related: #18672
I am now reasonably confident that
WeekOfMonth.apply
andLastWeekOfMonth.apply
both have a bug caused by usingself.getOffsetOfMonth(dt)
instead of `self._get_offset_day(dt)But given that
offset.onOffset(ts)
isTrue
, we would expectts + offset
to move back by 2 months, not 1.Surfacing this bug requires timestamps with non-zero nanos and n<0. I expect there are other cases that would surface with tzaware timestamps.
Not that hard to fix; I'd like to get #18762 in first to avoid merge conflicts.
The text was updated successfully, but these errors were encountered: