[SciPy-user] scikits.timeseries

Pierre GM pgmdevlist@gmail....
Thu Nov 27 12:40:24 CST 2008


On Nov 27, 2008, at 11:23 AM, Robert Ferrell wrote:

> Timeseries is an awesome package.  Great contribution.  I have 2
> questions about it, though.
>
> 1. Is scipy-user the right place for questions?

It is

> 2. I've noticed that 'business frequency' includes holidays, and that
> can create holes in what are actually complete data sets.  For
> instance, Sep 01, 2008 was a holiday in the US (Labor Day).

Yes, the moniker "business days" is a bit decepetive, as it refers  
only to days that are not Saturday or Sunday. It'd be too tricky for  
us to implement holidays, as it'd vary from one place to another (no  
such things as Thanksgiving in Europe, for example...).

>
> That has a hole on Sep 1.  This matters for things like moving average
> calculation.  Sep 1 should be treated like a Saturday or Sunday, but
> instead causes a 5-day mov_average calculation to not compute anything
> from Sep 2 through Sep 7:
>
> timeseries([-- -- -- -- 22.998 -- -- -- -- -- 21.06],
>            dates = [25-Aug-2008 ... 08-Sep-2008],
>            freq  = B)
>
> My question: What is a good way to handle (get rid of?) the holes in
> the series?

Mmh. On the top of my head, I'd do something like that:
* create a new series by using .compressed on your initial series.  
You'll get rid of the masked data and will have incomplete dates, but  
it shouldn't matter.
* use your moving average function on the new series.
* if needed, reset the missing dates by using fill_missing_dates on  
the filtered series.

Let me know how it goes.
P.






More information about the SciPy-user mailing list