471,305 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

numpy confusion

Hi all,

I'm trying to do some calculations with NumPy but apparently didn't
quite got the basics. For example I need Exponential Moving Average
function. That is, I have an array of values and want to apply a
function F(current, previous) to each element of the array. How can I
pass the 'previous' element to the function? In plain python it would
be a simple loop:

for index in arange(len(in_data[1:])):
result[index] = F(in_data[index], result[index-1])

I assume it's somehow possible with numpy.frompyfunc() and actually
found one example in SciPy TimeSeries library. Unfortunately I don't
fully understand how that one works :-/

Is anyone able to shed some light on this thing?


Oct 23 '07 #1
0 1326

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by jason | last post: by
20 posts views Thread by mclaugb | last post: by
13 posts views Thread by Gary Wessle | last post: by
3 posts views Thread by Iljya | last post: by
reply views Thread by robert | last post: by
2 posts views Thread by Chris Smith | last post: by
1 post views Thread by Jianzhong Liu | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.