Skip to content

Commit eec1039

Browse files
committed
Preserve freq in TimedeltaIndex subtraction
1 parent 3e1d6d5 commit eec1039

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/arrays/datetimelike.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,12 @@ def _get_arithmetic_result_freq(self, other) -> BaseOffset | None:
10891089
# e.g. TestTimedelta64ArithmeticUnsorted::test_timedelta
10901090
# Day is unambiguously 24h
10911091
return self.freq
1092+
elif (
1093+
lib.is_np_dtype(self.dtype, "M")
1094+
and isinstance(other, Timestamp)
1095+
and self.tz == other.tz
1096+
):
1097+
return self.freq
10921098

10931099
return None
10941100

0 commit comments

Comments
 (0)