Skip to content

Commit 1385e66

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

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pandas/core/arrays/datetimes.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
tzconversion,
4646
)
4747
from pandas._libs.tslibs.dtypes import abbrev_to_npy_unit
48-
from pandas._libs.tslibs.timedeltas import Timedelta
4948
from pandas.errors import PerformanceWarning
5049
from pandas.util._exceptions import find_stack_level
5150
from pandas.util._validators import validate_inclusive
@@ -82,6 +81,7 @@
8281
Iterator,
8382
)
8483

84+
from pandas._libs.tslibs.timedeltas import Timedelta
8585
from pandas._typing import (
8686
ArrayLike,
8787
DateTimeErrorChoices,
@@ -824,13 +824,8 @@ def _add_offset(self, offset: BaseOffset) -> Self:
824824
"s",
825825
]
826826
res_unit = self.unit
827-
offset_td = getattr(offset, "offset", None)
828-
if (
829-
offset_td is not None
830-
and isinstance(offset_td, Timedelta)
831-
and offset_td.value != 0
832-
):
833-
ns = abs(int(offset_td.value))
827+
if isinstance(offset, Tick):
828+
ns = abs(int(offset.value))
834829
if ns == 0:
835830
eff_unit = self.unit
836831
elif ns % 1_000_000_000 == 0:

0 commit comments

Comments
 (0)