55
66import numpy as np
77
8- from pandas .errors import NullFrequencyError
9-
108from pandas .core .dtypes .common import (
119 is_datetime64_dtype ,
1210 is_extension_array_dtype ,
@@ -96,10 +94,7 @@ def should_series_dispatch(left, right, op):
9694
9795
9896def dispatch_to_extension_op (
99- op ,
100- left : Union [ABCExtensionArray , np .ndarray ],
101- right : Any ,
102- keep_null_freq : bool = False ,
97+ op , left : Union [ABCExtensionArray , np .ndarray ], right : Any ,
10398):
10499 """
105100 Assume that left or right is a Series backed by an ExtensionArray,
@@ -110,9 +105,6 @@ def dispatch_to_extension_op(
110105 op : binary operator
111106 left : ExtensionArray or np.ndarray
112107 right : object
113- keep_null_freq : bool, default False
114- Whether to re-raise a NullFrequencyError unchanged, as opposed to
115- catching and raising TypeError.
116108
117109 Returns
118110 -------
@@ -130,18 +122,5 @@ def dispatch_to_extension_op(
130122
131123 # The op calls will raise TypeError if the op is not defined
132124 # on the ExtensionArray
133-
134- try :
135- res_values = op (left , right )
136- except NullFrequencyError :
137- # DatetimeIndex and TimedeltaIndex with freq == None raise ValueError
138- # on add/sub of integers (or int-like). We re-raise as a TypeError.
139- if keep_null_freq :
140- # TODO: remove keep_null_freq after Timestamp+int deprecation
141- # GH#22535 is enforced
142- raise
143- raise TypeError (
144- "incompatible type for a datetime/timedelta "
145- "operation [{name}]" .format (name = op .__name__ )
146- )
125+ res_values = op (left , right )
147126 return res_values
0 commit comments