Skip to content

Commit 9de1b45

Browse files
committed
Avoid dispatch_to_index_op in a couple places
1 parent 880988c commit 9de1b45

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/core/ops/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1096,12 +1096,13 @@ def wrapper(self, other, axis=None):
10961096
elif is_datetime64_dtype(self) or is_datetime64tz_dtype(self):
10971097
# Dispatch to DatetimeIndex to ensure identical
10981098
# Series/Index behavior
1099-
1100-
res_values = dispatch_to_index_op(op, self, other, pd.DatetimeIndex)
1099+
from pandas.core.arrays import DatetimeArray
1100+
res_values = dispatch_to_extension_op(op, DatetimeArray(self), other)
11011101
return self._constructor(res_values, index=self.index, name=res_name)
11021102

11031103
elif is_timedelta64_dtype(self):
1104-
res_values = dispatch_to_index_op(op, self, other, pd.TimedeltaIndex)
1104+
from pandas.core.arrays import TimedeltaArray
1105+
res_values = dispatch_to_extension_op(op, TimedeltaArray(self), other)
11051106
return self._constructor(res_values, index=self.index, name=res_name)
11061107

11071108
elif is_extension_array_dtype(self) or (

0 commit comments

Comments
 (0)