|
7 | 7 |
|
8 | 8 | from pandas._libs import algos, lib |
9 | 9 | from pandas._libs.tslibs import ( |
| 10 | + BaseOffset, |
10 | 11 | NaT, |
11 | 12 | NaTType, |
12 | 13 | Period, |
13 | 14 | Resolution, |
| 15 | + Tick, |
14 | 16 | Timestamp, |
15 | 17 | delta_to_nanoseconds, |
16 | 18 | iNaT, |
|
62 | 64 | from pandas.core.ops.invalid import invalid_comparison, make_invalid_op |
63 | 65 |
|
64 | 66 | from pandas.tseries import frequencies |
65 | | -from pandas.tseries.offsets import DateOffset, Tick |
66 | 67 |
|
67 | 68 | DTScalarOrNaT = Union[DatetimeLikeScalar, NaTType] |
68 | 69 |
|
@@ -421,7 +422,7 @@ def _with_freq(self, freq): |
421 | 422 | if freq is None: |
422 | 423 | # Always valid |
423 | 424 | pass |
424 | | - elif len(self) == 0 and isinstance(freq, DateOffset): |
| 425 | + elif len(self) == 0 and isinstance(freq, BaseOffset): |
425 | 426 | # Always valid. In the TimedeltaArray case, we assume this |
426 | 427 | # is a Tick offset. |
427 | 428 | pass |
@@ -1398,7 +1399,7 @@ def __add__(self, other): |
1398 | 1399 | result = self._add_nat() |
1399 | 1400 | elif isinstance(other, (Tick, timedelta, np.timedelta64)): |
1400 | 1401 | result = self._add_timedeltalike_scalar(other) |
1401 | | - elif isinstance(other, DateOffset): |
| 1402 | + elif isinstance(other, BaseOffset): |
1402 | 1403 | # specifically _not_ a Tick |
1403 | 1404 | result = self._add_offset(other) |
1404 | 1405 | elif isinstance(other, (datetime, np.datetime64)): |
@@ -1454,7 +1455,7 @@ def __sub__(self, other): |
1454 | 1455 | result = self._sub_nat() |
1455 | 1456 | elif isinstance(other, (Tick, timedelta, np.timedelta64)): |
1456 | 1457 | result = self._add_timedeltalike_scalar(-other) |
1457 | | - elif isinstance(other, DateOffset): |
| 1458 | + elif isinstance(other, BaseOffset): |
1458 | 1459 | # specifically _not_ a Tick |
1459 | 1460 | result = self._add_offset(-other) |
1460 | 1461 | elif isinstance(other, (datetime, np.datetime64)): |
@@ -1778,7 +1779,7 @@ def maybe_infer_freq(freq): |
1778 | 1779 | Whether we should inherit the freq of passed data. |
1779 | 1780 | """ |
1780 | 1781 | freq_infer = False |
1781 | | - if not isinstance(freq, DateOffset): |
| 1782 | + if not isinstance(freq, BaseOffset): |
1782 | 1783 | # if a passed freq is None, don't infer automatically |
1783 | 1784 | if freq != "infer": |
1784 | 1785 | freq = to_offset(freq) |
|
0 commit comments