time series calculation in list comprehension?

beliavsky at aol.com beliavsky at aol.com
Fri Mar 10 13:01:00 EST 2006


falcon wrote:
> Is there a way I can do time series calculation, such as a moving
> average in list comprehension syntax?  I'm new to python but it looks
> like list comprehension's 'head' can only work at a value at a time.  I
> also tried using the reduce function and passed in my list and another
> function which calculates a moving average outside the list comp. ...
> but I'm not clear how to do it.  Any ideas?  Thanks.

I suggest that statistical data, including time series, be stored and
processed in arrays, such as the one found in NumPy. You can compute
averages using the "sum" function and array slices.




More information about the Python-list mailing list