Skip to content

Commit 880988c

Browse files
committed
replace usage of dispatch_to_index_op
1 parent cb3c3c6 commit 880988c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

pandas/core/ops/__init__.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,9 @@ def wrapper(left, right):
935935
)
936936

937937
elif is_datetime64_dtype(left) or is_datetime64tz_dtype(left):
938-
# Give dispatch_to_index_op a chance for tests like
939-
# test_dt64_series_add_intlike, which the index dispatching handles
940-
# specifically.
941-
result = dispatch_to_index_op(op, left, right, pd.DatetimeIndex)
942-
return construct_result(
943-
left, result, index=left.index, name=res_name, dtype=result.dtype
944-
)
938+
from pandas.core.arrays import DatetimeArray
939+
result = dispatch_to_extension_op(op, DatetimeArray(left), right)
940+
return construct_result(left, result, index=left.index, name=res_name)
945941

946942
elif is_extension_array_dtype(left) or (
947943
is_extension_array_dtype(right) and not is_scalar(right)
@@ -1094,7 +1090,7 @@ def wrapper(self, other, axis=None):
10941090
elif is_categorical_dtype(self):
10951091
# Dispatch to Categorical implementation; CategoricalIndex
10961092
# behavior is non-canonical GH#19513
1097-
res_values = dispatch_to_index_op(op, self, other, pd.Categorical)
1093+
res_values = dispatch_to_extension_op(op, self, other)
10981094
return self._constructor(res_values, index=self.index, name=res_name)
10991095

11001096
elif is_datetime64_dtype(self) or is_datetime64tz_dtype(self):

0 commit comments

Comments
 (0)