Skip to content

Commit e54c162

Browse files
committed
BUG: Fix dt64[non_nano] + offset rounding
1 parent 00ee4c8 commit e54c162

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pandas/core/arrays/datetimes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,9 @@ def _add_offset(self, offset: BaseOffset) -> Self:
827827
if hasattr(offset, "offset"):
828828
offset_td = Timedelta(offset.offset)
829829
offset_unit = offset_td.unit
830-
if self.unit in units and offset_unit in units:
831-
idx_self = units.index(self.unit)
832-
idx_offset = units.index(offset_unit)
833-
res_unit = units[min(idx_self, idx_offset)]
830+
idx_self = units.index(self.unit)
831+
idx_offset = units.index(offset_unit)
832+
res_unit = units[min(idx_self, idx_offset)]
834833
result = type(self)._simple_new(res_values, dtype=res_values.dtype)
835834
result = result.as_unit(res_unit)
836835

0 commit comments

Comments
 (0)