Skip to content

Commit ac80418

Browse files
committed
BUG: Fix dt64[non_nano] + offset rounding
1 parent 1385e66 commit ac80418

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pandas/core/arrays/datetimes.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
from pandas.tseries.frequencies import get_period_alias
7272
from pandas.tseries.offsets import (
73+
CustomBusinessDay,
7374
Day,
7475
Tick,
7576
)
@@ -824,8 +825,18 @@ def _add_offset(self, offset: BaseOffset) -> Self:
824825
"s",
825826
]
826827
res_unit = self.unit
827-
if isinstance(offset, Tick):
828-
ns = abs(int(offset.value))
828+
if isinstance(offset, Tick) or (
829+
isinstance(offset, CustomBusinessDay)
830+
and offset.offset is not None
831+
and offset.offset.value != 0
832+
):
833+
ns = abs(
834+
int(
835+
offset.value
836+
if isinstance(offset, Tick)
837+
else offset.offset.value
838+
)
839+
)
829840
if ns == 0:
830841
eff_unit = self.unit
831842
elif ns % 1_000_000_000 == 0:

0 commit comments

Comments
 (0)