Is it possible to define a semi-annual frequency for a python scikits.timeseries time_series object?
Frage
According to the scikits.timeseries module the following frequencies are available when defining a time_series object:
- Annual Frequencies, Quarterly frequencies, Monthly, Weekly, Daily etc. A full list is shown on the documentation link: http://pytseries.sourceforge.net/core.constants.html#scikits.timeseries.const.freq_constants
The frequencies exclude semi-annual (twice a year).
How would one define a semi-annual frequency for a scikits.timeseries.time_series object? Does a work-around exist?
Lösung
Define quaterly frequency and fill it to 50%:
import scikits.timeseries as ts
dates = ts.date_array(start_date=ts.Date('Q', '2009-01'),
end_date=ts.Date('Q', '2011-01'))
data = ts.TimeSeries(np.arange(9), dates=dates, mask=1-dates.quarter%2)
# returns:
timeseries([0 -- 2 -- 4 -- 6 -- 8],
dates = [2009Q1 ... 2011Q1],
freq = Q-DEC)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow