[SciPy-user] moving average, moving standard deviation, etc...

Matt Knox mattknox_ca at hotmail.com
Sat Dec 23 12:42:39 CST 2006

Does anyone know of a slick way to calculate a simple moving average and/or moving standard deviation? And when I say slick, I mean loop-free way, because it would be fairly easy to code a looping way of doing it, it would just be really slow.

To be more specific, when I say moving standard deviation, I mean for example...

if A is a 1-dimensional array with 100 elements, and I'm using a window size of 10, then the result at index 10 would be A[0:10].std(), the result at index 11 would be A[1:11].std() , etc...  

And similarly for moving average, and so forth. Is their a general way to do these kind of things? Or would it have to be a special case for each type of calculation to avoid looping?

Any help is greatly appreciated. Thanks in advance,

- Matt

More information about the SciPy-user mailing list