2424from pandas .core .common import AbstractMethodError
2525
2626import pandas .io .formats .printing as printing
27- from pandas ._libs import (tslib as libts , lib ,
28- Timedelta , Timestamp , iNaT , NaT )
27+ from pandas ._libs import (tslib as libts , lib , iNaT , NaT )
2928from pandas ._libs .period import Period
3029
3130from pandas .core .indexes .base import Index , _index_shared_docs
@@ -649,13 +648,11 @@ def __add__(self, other):
649648 return other ._add_delta (self )
650649 raise TypeError ("cannot add TimedeltaIndex and {typ}"
651650 .format (typ = type (other )))
652- elif isinstance (other , (DateOffset , timedelta , np .timedelta64 ,
653- Timedelta )):
651+ elif isinstance (other , (DateOffset , timedelta , np .timedelta64 )):
654652 return self ._add_delta (other )
655653 elif is_integer (other ):
656654 return self .shift (other )
657- elif isinstance (other , (Index , Timestamp , datetime ,
658- np .datetime64 )):
655+ elif isinstance (other , (Index , datetime , np .datetime64 )):
659656 return self ._add_datelike (other )
660657 else : # pragma: no cover
661658 return NotImplemented
@@ -680,12 +677,11 @@ def __sub__(self, other):
680677 raise TypeError ("cannot subtract {typ1} and {typ2}"
681678 .format (typ1 = type (self ).__name__ ,
682679 typ2 = type (other ).__name__ ))
683- elif isinstance (other , (DateOffset , timedelta , np .timedelta64 ,
684- Timedelta )):
680+ elif isinstance (other , (DateOffset , timedelta , np .timedelta64 )):
685681 return self ._add_delta (- other )
686682 elif is_integer (other ):
687683 return self .shift (- other )
688- elif isinstance (other , ( Timestamp , datetime ) ):
684+ elif isinstance (other , datetime ):
689685 return self ._sub_datelike (other )
690686 elif isinstance (other , Period ):
691687 return self ._sub_period (other )
0 commit comments