Skip to content

Commit 67faabc

Browse files
committed
rename to time_shift
1 parent c3a96d0 commit 67faabc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
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
----------
@@ -553,9 +553,9 @@ def shift(self, periods, freq=None):
553553
--------
554554
Index.shift : Shift values of Index.
555555
"""
556-
return self._tshift(periods=periods, freq=freq)
556+
return self._time_shift(periods=periods, freq=freq)
557557

558-
def _tshift(self, periods, freq=None):
558+
def _time_shift(self, periods, freq=None):
559559
"""
560560
Shift each value by `periods`.
561561
@@ -617,7 +617,7 @@ def __add__(self, other):
617617
elif lib.is_integer(other):
618618
# This check must come after the check for np.timedelta64
619619
# as is_integer returns True for these
620-
result = self._tshift(other)
620+
result = self._time_shift(other)
621621

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

pandas/core/arrays/period.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _add_offset(self, other):
297297
if base != self.freq.rule_code:
298298
msg = DIFFERENT_FREQ_INDEX.format(self.freqstr, other.freqstr)
299299
raise IncompatibleFrequency(msg)
300-
return self._tshift(other.n)
300+
return self._time_shift(other.n)
301301

302302
def _add_delta_td(self, other):
303303
assert isinstance(other, (timedelta, np.timedelta64, Tick))
@@ -307,7 +307,7 @@ def _add_delta_td(self, other):
307307
if isinstance(own_offset, Tick):
308308
offset_nanos = delta_to_nanoseconds(own_offset)
309309
if np.all(nanos % offset_nanos == 0):
310-
return self._tshift(nanos // offset_nanos)
310+
return self._time_shift(nanos // offset_nanos)
311311

312312
# raise when input doesn't have freq
313313
raise IncompatibleFrequency("Input has different freq from "
@@ -317,7 +317,7 @@ def _add_delta_td(self, other):
317317

318318
def _add_delta(self, other):
319319
ordinal_delta = self._maybe_convert_timedelta(other)
320-
return self._tshift(ordinal_delta)
320+
return self._time_shift(ordinal_delta)
321321

322322
def shift(self, n):
323323
"""
@@ -332,9 +332,9 @@ def shift(self, n):
332332
-------
333333
shifted : Period Array/Index
334334
"""
335-
return self._tshift(n)
335+
return self._time_shift(n)
336336

337-
def _tshift(self, n):
337+
def _time_shift(self, n):
338338
values = self._ndarray_values + n * self.freq.n
339339
if self.hasnans:
340340
values[self._isnan] = iNaT

0 commit comments

Comments
 (0)