Skip to content

Commit fbde770

Browse files
committed
Squashed commit of the following:
commit bccfc3f Merge: d65980e 9caf048 Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 13:47:48 2018 -0500 Merge remote-tracking branch 'upstream/master' into period-dtype-type commit 9caf048 Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 13:25:22 2018 -0500 CI: change windows vm image (pandas-dev#22948) commit d65980e Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 11:46:38 2018 -0500 typo commit e5c61fc Merge: d7a8e1b 1d9f76c Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 10:57:59 2018 -0500 Merge remote-tracking branch 'upstream/master' into period-dtype-type commit d7a8e1b Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 10:57:56 2018 -0500 Fixed commit 598cc62 Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 10:32:22 2018 -0500 doc note commit 83db05c Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 10:28:52 2018 -0500 updates commit 1d9f76c Author: Joris Van den Bossche <[email protected]> Date: Tue Oct 2 17:11:11 2018 +0200 CLN: remove Index._to_embed (pandas-dev#22879) * CLN: remove Index._to_embed * pep8 commit 6247da0 Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 08:50:41 2018 -0500 Provide default implementation for `data_repated` (pandas-dev#22935) commit f07ab80 Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 06:22:27 2018 -0500 str, bytes commit 8a8bdb0 Author: Tom Augspurger <[email protected]> Date: Mon Oct 1 21:40:59 2018 -0500 import at top commit 99bafdd Author: Tom Augspurger <[email protected]> Date: Mon Oct 1 21:38:12 2018 -0500 Update type for PeriodDtype Removed unused IntervalDtypeType commit 5ce06b5 Author: Matthew Roeschke <[email protected]> Date: Mon Oct 1 14:22:20 2018 -0700 BUG: to_datetime preserves name of Index argument in the result (pandas-dev#22918) * BUG: to_datetime preserves name of Index argument in the result * correct test Merge branch 'datetimelike-tshift' into ea-period
2 parents c2d57bd + 67faabc commit fbde770

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pandas/core/arrays/datetimelike.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def _sub_period_array(self, other):
455455
def _addsub_int_array(self, other, op):
456456
"""
457457
Add or subtract array-like of integers equivalent to applying
458-
`_tshift` pointwise.
458+
`_time_shift` pointwise.
459459
460460
Parameters
461461
----------
@@ -552,9 +552,9 @@ def shift(self, periods, freq=None):
552552
--------
553553
Index.shift : Shift values of Index.
554554
"""
555-
return self._tshift(periods, freq=freq)
555+
return self._time_shift(periods=periods, freq=freq)
556556

557-
def _tshift(self, periods, freq=None):
557+
def _time_shift(self, periods, freq=None):
558558
"""
559559
Shift each value by `periods`.
560560
@@ -616,7 +616,7 @@ def __add__(self, other):
616616
elif lib.is_integer(other):
617617
# This check must come after the check for np.timedelta64
618618
# as is_integer returns True for these
619-
result = self._tshift(other)
619+
result = self._time_shift(other)
620620

621621
# array-like others
622622
elif is_timedelta64_dtype(other):
@@ -668,7 +668,7 @@ def __sub__(self, other):
668668
elif lib.is_integer(other):
669669
# This check must come after the check for np.timedelta64
670670
# as is_integer returns True for these
671-
result = self._tshift(-other)
671+
result = self._time_shift(-other)
672672
elif isinstance(other, Period):
673673
result = self._sub_period(other)
674674

pandas/core/arrays/period.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def _add_offset(self, other):
572572
if base != self.freq.rule_code:
573573
msg = DIFFERENT_FREQ_INDEX.format(self.freqstr, other.freqstr)
574574
raise IncompatibleFrequency(msg)
575-
return self._tshift(other.n)
575+
return self._time_shift(other.n)
576576

577577
def _add_delta_td(self, other):
578578
assert isinstance(other, (timedelta, np.timedelta64, Tick))
@@ -582,7 +582,7 @@ def _add_delta_td(self, other):
582582
if isinstance(own_offset, Tick):
583583
offset_nanos = delta_to_nanoseconds(own_offset)
584584
if np.all(nanos % offset_nanos == 0):
585-
return self._tshift(nanos // offset_nanos)
585+
return self._time_shift(nanos // offset_nanos)
586586

587587
# raise when input doesn't have freq
588588
raise IncompatibleFrequency("Input has different freq from "
@@ -592,7 +592,7 @@ def _add_delta_td(self, other):
592592

593593
def _add_delta(self, other):
594594
ordinal_delta = self._maybe_convert_timedelta(other)
595-
return self._tshift(ordinal_delta)
595+
return self._time_shift(ordinal_delta)
596596

597597
def shift(self, periods=1):
598598
"""
@@ -612,7 +612,7 @@ def shift(self, periods=1):
612612
# then just call super.
613613
return ExtensionArray.shift(self, periods)
614614

615-
def _tshift(self, n, freq=None):
615+
def _time_shift(self, n, freq=None):
616616
"""
617617
Shift each value by `periods`.
618618

0 commit comments

Comments
 (0)