Somehow some questions got merged or deleted, so I'll post my answer here.
Exp smoothing in Python natively.
'''
simple exponential smoothing
go back to last N values
y_t = a * y_t + a * (1-a)^1 * y_t-1 + a * (1-a)^2 * y_t-2 + ... + a*(1-a)^n * y_t-n
'''
from random import random,randint
def gen_weights(a,N):
ws = list()
for i in range(N):
w = a * ((1-a)**i)
ws.append(w)
return ws
def weighted(data,ws):
wt = list()
for i,x in enumerate(data):
wt.append(x*ws[i])
return wt
N = 10
a = 0.5
ws = gen_weights(a,N)
data = [randint(0,100) for r in xrange(N)]
weighted_data = weighted(data,ws)
print 'data: ',data
print 'weights: ',ws
print 'weighted data: ',weighted_data
print 'weighted avg: ',sum(weighted_data)