iode.Period.shift
- Period.shift(nb_periods: int) Self[source]
Shift the current period by a number of sub periods. If the number of sub periods is positive, the shift is time forward. Conversely, if the number of sub periods is negative, the shift is time backward.
- Parameters:
- nb_periods: int
Number of sub periods. The shift is time forward if positive and time backward if negative.
- Returns:
- shifted_period: Period
Examples
>>> from iode import Period >>> period = Period(2000, 'Q', 1) >>> period Period("2000Q1") >>> # shift forward >>> shifted_period = period.shift(7) >>> shifted_period Period("2001Q4") >>> # shift backward >>> shifted_period = period.shift(-7) >>> shifted_period Period("1998Q2")