Fri Nov 28 13:03:50 CST 2008
It's always easier to manipulate series withoutmissing data. The trick
I gave you earlier about computing a moving average after having
removed the missing dates was that, just a trick. However, I'm
confident it should work.
Unfortunately, there's no easy way to define new frequencies, and it's
not on or todo list either. Frequencies are defined in the C part of
On Nov 28, 2008, at 12:09 AM, Robert Ferrell 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
>>> calculation. Sep 1 should be treated like a Saturday or Sunday, but
>>> instead causes a 5-day mov_average calculation to not compute
>>> 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.
> 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?
> SciPy-user mailing list
More information about the SciPy-user