staircase.Stairs.shift#
- Stairs.shift(delta)#
Returns a stairs instance corresponding to a horizontal translation by delta
If delta is positive the corresponding step function is moved right. If delta is negative the corresponding step function is moved left.
- Parameters
- deltaint, float or pandas.Timedelta
the amount by which to translate. A pandas.Timedelta is only valid when using dates. If using dates and delta is an int or float, then it is interpreted as a number of hours.
- Returns
See also
Examples
Note that the definition of shift is designed to be consistent with
pandas.Series.shift()
>>> pd.Series(s2(range(7))) 0 0.5 1 0.5 2 0.0 3 -1.0 4 -1.0 5 -1.0 6 0.0 dtype: float64
>>> pd.Series(s2(range(7))).shift(1) 0 NaN 1 0.5 2 0.5 3 0.0 4 -1.0 5 -1.0 6 -1.0 dtype: float64
>>> pd.Series(s2.shift(1)(range(7))) 0 0.0 1 0.5 2 0.5 3 0.0 4 -1.0 5 -1.0 6 -1.0 dtype: float64