Skip to content

Commit 2730c89

Browse files
committed
BUG: Fix dt64[non_nano] + offset rounding
1 parent 9372a88 commit 2730c89

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

pandas/core/arrays/datetimes.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -826,17 +826,11 @@ def _add_offset(self, offset: BaseOffset) -> Self:
826826
]
827827
res_unit = self.unit
828828
if type(offset) is DateOffset:
829-
nano = offset.kwds.get("nanoseconds", 0)
830-
micro = offset.kwds.get("microseconds", 0)
831-
if nano:
829+
if "nanoseconds" in offset.kwds:
832830
res_unit = "ns"
833-
elif micro and self.unit != "ns":
831+
elif "microseconds" in offset.kwds and self.unit != "ns":
834832
res_unit = "us"
835-
if (
836-
hasattr(offset, "offset")
837-
and offset.offset is not None
838-
and not isinstance(offset, Tick)
839-
):
833+
if hasattr(offset, "offset") and offset.offset is not None:
840834
offset_td = Timedelta(offset.offset)
841835
if offset_td.value != 0:
842836
offset_unit = offset_td.unit

0 commit comments

Comments
 (0)