Previous topic

scikits.timeseries.aligned

Next topic

Loading a TimeSeries from a text file

This Page

scikits.timeseries.TimeSeries.tshift

TimeSeries.tshift(series, nper, copy=True)

Returns a series of the same size as series, with the same start_date and end_date, but values shifted by nper.

Parameters:

series : TimeSeries

TimeSeries object to shift. Ignore this parameter if calling this as a method.

nper : int

Number of periods to shift. Negative numbers shift values to the right, positive to the left.

copy : {True, False}, optional

copies the data if True, returns a view if False.

Examples

>>> series = time_series([0,1,2,3], start_date=Date(freq='A', year=2005))
>>> series
timeseries(data  = [0 1 2 3],
           dates = [2005 ... 2008],
           freq  = A-DEC)
>>> tshift(series, -1)
timeseries(data  = [-- 0 1 2],
           dates = [2005 ... 2008],
           freq  = A-DEC)
>>> pct_change = 100 * (series/series.tshift(-1, copy=False) - 1)