[SciPy-User] Question about scikits.timeseries.lib.moving_funcs.mov_average
Wed Jun 23 10:45:56 CDT 2010
Thanks a lot for your input!
> You could try to fill your missing values beforehand, w/ functions like
> backward_fill and forward_fill, then passing your series to mov_average.
Well, that's not really what I want. By doing what you suggest, I make the
assumption that the value actually changed on the day for which I have the
measurement. But each measurement is only one single point in time, so I
do not want to make this assumption.
> Or the reverse way: compress your data to get rid of the missing values,
> pass it to mov_average, reconvert it to a daily series w/
> fill_missing_dates (to get the right number of dates), then fill it w/
> backward_fill or forward_fill.
See above. Also not really what I want.
Basically, I'm looking for a simple and efficient way to do something like
w = 11 # the window size
s = (w-1)*.5
for d in data.dates:
newdata[d] = data[d-s:d+s+1].mean()
More information about the SciPy-User