|
32 | 32 | from pandas.core.algorithms import (
|
33 | 33 | checked_add_with_arr, take, unique1d, value_counts)
|
34 | 34 | import pandas.core.common as com
|
| 35 | +from pandas.core.ops import CompWrapper |
35 | 36 |
|
36 | 37 | from pandas.tseries import frequencies
|
37 | 38 | from pandas.tseries.offsets import DateOffset, Tick
|
@@ -1175,13 +1176,10 @@ def _time_shift(self, periods, freq=None):
|
1175 | 1176 | return self._generate_range(start=start, end=end, periods=None,
|
1176 | 1177 | freq=self.freq)
|
1177 | 1178 |
|
| 1179 | + @CompWrapper(zerodim=True, inst_from_senior_cls=True) |
1178 | 1180 | def __add__(self, other):
|
1179 |
| - other = lib.item_from_zerodim(other) |
1180 |
| - if isinstance(other, (ABCSeries, ABCDataFrame)): |
1181 |
| - return NotImplemented |
1182 |
| - |
1183 | 1181 | # scalar others
|
1184 |
| - elif other is NaT: |
| 1182 | + if other is NaT: |
1185 | 1183 | result = self._add_nat()
|
1186 | 1184 | elif isinstance(other, (Tick, timedelta, np.timedelta64)):
|
1187 | 1185 | result = self._add_delta(other)
|
@@ -1238,13 +1236,10 @@ def __radd__(self, other):
|
1238 | 1236 | # alias for __add__
|
1239 | 1237 | return self.__add__(other)
|
1240 | 1238 |
|
| 1239 | + @CompWrapper(zerodim=True, inst_from_senior_cls=True) |
1241 | 1240 | def __sub__(self, other):
|
1242 |
| - other = lib.item_from_zerodim(other) |
1243 |
| - if isinstance(other, (ABCSeries, ABCDataFrame)): |
1244 |
| - return NotImplemented |
1245 |
| - |
1246 | 1241 | # scalar others
|
1247 |
| - elif other is NaT: |
| 1242 | + if other is NaT: |
1248 | 1243 | result = self._sub_nat()
|
1249 | 1244 | elif isinstance(other, (Tick, timedelta, np.timedelta64)):
|
1250 | 1245 | result = self._add_delta(-other)
|
|
0 commit comments