Skip to content

BUG: Fix PeriodIndex +/- TimedeltaIndex #23031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 15, 2018
Merged
Prev Previous commit
Next Next commit
Merge branch 'master' of https://github.com/pandas-dev/pandas into pi…
…_add
  • Loading branch information
jbrockmendel committed Oct 9, 2018
commit e1ebe090bc972a95b436bf28166d1f408fdbe6c5
8 changes: 5 additions & 3 deletions pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from pandas.util._decorators import (cache_readonly, deprecate_kwarg)

from pandas.core.dtypes.common import (
_TD_DTYPE,
is_integer_dtype, is_float_dtype, is_period_dtype, is_timedelta64_dtype)
is_integer_dtype, is_float_dtype, is_period_dtype, is_timedelta64_dtype,
is_datetime64_dtype, _TD_DTYPE)
from pandas.core.dtypes.dtypes import PeriodDtype
from pandas.core.dtypes.generic import ABCSeries

Expand Down Expand Up @@ -458,6 +458,8 @@ def _maybe_convert_timedelta(self, other):
"""
if isinstance(
other, (timedelta, np.timedelta64, Tick, np.ndarray)):
# TODO: is the np.ndarray case still relevant now that Arithmetic
# methods don't call this method?
offset = frequencies.to_offset(self.freq.rule_code)
if isinstance(offset, Tick):
# _check_timedeltalike_freq_compat will raise if incompatible
Expand Down Expand Up @@ -499,7 +501,7 @@ def _check_timedeltalike_freq_compat(self, other):
else:
# TimedeltaArray/Index
nanos = other.asi8

if np.all(nanos % base_nanos == 0):
# nanos being added is an integer multiple of the
# base-frequency to self.freq
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.