|
5 | 5 |
|
6 | 6 | from pandas._libs import index as libindex
|
7 | 7 | from pandas._libs.lib import no_default
|
8 |
| -from pandas._libs.tslibs import Period, frequencies as libfrequencies, resolution |
| 8 | +from pandas._libs.tslibs import Period, resolution |
9 | 9 | from pandas._libs.tslibs.parsing import parse_time_string
|
10 | 10 | from pandas._typing import DtypeObj, Label
|
11 | 11 | from pandas.util._decorators import Appender, cache_readonly, doc
|
|
44 | 44 | from pandas.core.ops import get_op_result_name
|
45 | 45 | from pandas.core.tools.datetimes import DateParseError
|
46 | 46 |
|
47 |
| -from pandas.tseries import frequencies |
48 | 47 | from pandas.tseries.offsets import DateOffset, Tick
|
49 | 48 |
|
50 | 49 | _index_doc_kwargs = dict(ibase._index_doc_kwargs)
|
@@ -278,15 +277,12 @@ def _maybe_convert_timedelta(self, other):
|
278 | 277 | of self.freq. Note IncompatibleFrequency subclasses ValueError.
|
279 | 278 | """
|
280 | 279 | if isinstance(other, (timedelta, np.timedelta64, Tick, np.ndarray)):
|
281 |
| - offset = frequencies.to_offset(self.freq.rule_code) |
282 |
| - if isinstance(offset, Tick): |
| 280 | + if isinstance(self.freq, Tick): |
283 | 281 | # _check_timedeltalike_freq_compat will raise if incompatible
|
284 | 282 | delta = self._data._check_timedeltalike_freq_compat(other)
|
285 | 283 | return delta
|
286 | 284 | elif isinstance(other, DateOffset):
|
287 |
| - freqstr = other.rule_code |
288 |
| - base = libfrequencies.get_base_alias(freqstr) |
289 |
| - if base == self.freq.rule_code: |
| 285 | + if other.base == self.freq.base: |
290 | 286 | return other.n
|
291 | 287 |
|
292 | 288 | raise raise_on_incompatible(self, other)
|
|
0 commit comments