Is it possible to define a semi-annual frequency for a python scikits.timeseries time_series object?

StackOverflow https://stackoverflow.com/questions/4875228

  •  28-10-2019
  •  | 
  •  

Question

According to the scikits.timeseries module the following frequencies are available when defining a time_series object:

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?

Was it helpful?

Solution

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top