[SciPy-user] scikits.timeseries

Robert Ferrell ferrell@diablotech....
Thu Nov 27 23:09:53 CST 2008


On Nov 27, 2008, at 11:40 AM, Pierre GM wrote:

>
> On Nov 27, 2008, at 11:23 AM, Robert Ferrell wrote:
>
>>
>> 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.

Since the date arrays has holes, I can't use timeseries date range  
calculations.  So, for instance, to get the previous 5 days of data I  
can't just use series[d-5:d].  Instead I need to (I think) convert to  
an index, series.date_to_index(d), and then use that index.   I'm  
going to try that, along with using .compressed(), and see how I do.

Is there any possibility of allowing user defined frequencies?

thanks,
-robert


More information about the SciPy-user mailing list