24
24
from pandas .core .common import AbstractMethodError
25
25
26
26
import 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 )
29
28
from pandas ._libs .period import Period
30
29
31
30
from pandas .core .indexes .base import Index , _index_shared_docs
@@ -649,13 +648,11 @@ def __add__(self, other):
649
648
return other ._add_delta (self )
650
649
raise TypeError ("cannot add TimedeltaIndex and {typ}"
651
650
.format (typ = type (other )))
652
- elif isinstance (other , (DateOffset , timedelta , np .timedelta64 ,
653
- Timedelta )):
651
+ elif isinstance (other , (DateOffset , timedelta , np .timedelta64 )):
654
652
return self ._add_delta (other )
655
653
elif is_integer (other ):
656
654
return self .shift (other )
657
- elif isinstance (other , (Index , Timestamp , datetime ,
658
- np .datetime64 )):
655
+ elif isinstance (other , (Index , datetime , np .datetime64 )):
659
656
return self ._add_datelike (other )
660
657
else : # pragma: no cover
661
658
return NotImplemented
@@ -680,12 +677,11 @@ def __sub__(self, other):
680
677
raise TypeError ("cannot subtract {typ1} and {typ2}"
681
678
.format (typ1 = type (self ).__name__ ,
682
679
typ2 = type (other ).__name__ ))
683
- elif isinstance (other , (DateOffset , timedelta , np .timedelta64 ,
684
- Timedelta )):
680
+ elif isinstance (other , (DateOffset , timedelta , np .timedelta64 )):
685
681
return self ._add_delta (- other )
686
682
elif is_integer (other ):
687
683
return self .shift (- other )
688
- elif isinstance (other , ( Timestamp , datetime ) ):
684
+ elif isinstance (other , datetime ):
689
685
return self ._sub_datelike (other )
690
686
elif isinstance (other , Period ):
691
687
return self ._sub_period (other )
0 commit comments