1313from pandas import compat
1414
1515
16- from pandas .core .dtypes .generic import ABCSeries , ABCMultiIndex , ABCPeriodIndex
16+ from pandas .core .dtypes .generic import (
17+ ABCSeries ,
18+ ABCMultiIndex ,
19+ ABCPeriodIndex ,
20+ ABCDateOffset )
1721from pandas .core .dtypes .missing import isna , array_equivalent
1822from pandas .core .dtypes .common import (
1923 _ensure_int64 ,
@@ -3814,8 +3818,6 @@ def _validate_for_numeric_binop(self, other, op, opstr):
38143818
38153819 internal method called by ops
38163820 """
3817- from pandas .tseries .offsets import DateOffset
3818-
38193821 # if we are an inheritor of numeric,
38203822 # but not actually numeric (e.g. DatetimeIndex/PeriodInde)
38213823 if not self ._is_numeric_dtype :
@@ -3843,7 +3845,7 @@ def _validate_for_numeric_binop(self, other, op, opstr):
38433845 if other .dtype .kind not in ['f' , 'i' , 'u' ]:
38443846 raise TypeError ("cannot evaluate a numeric op "
38453847 "with a non-numeric dtype" )
3846- elif isinstance (other , (DateOffset , np .timedelta64 ,
3848+ elif isinstance (other , (ABCDateOffset , np .timedelta64 ,
38473849 Timedelta , datetime .timedelta )):
38483850 # higher up to handle
38493851 pass
@@ -3862,12 +3864,10 @@ def _add_numeric_methods_binary(cls):
38623864
38633865 def _make_evaluate_binop (op , opstr , reversed = False , constructor = Index ):
38643866 def _evaluate_numeric_binop (self , other ):
3865-
3866- from pandas .tseries .offsets import DateOffset
38673867 other = self ._validate_for_numeric_binop (other , op , opstr )
38683868
38693869 # handle time-based others
3870- if isinstance (other , (DateOffset , np .timedelta64 ,
3870+ if isinstance (other , (ABCDateOffset , np .timedelta64 ,
38713871 Timedelta , datetime .timedelta )):
38723872 return self ._evaluate_with_timedelta_like (other , op , opstr )
38733873 elif isinstance (other , (Timestamp , np .datetime64 )):
0 commit comments