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 range(N)]
weighted_data = weighted(data, ws)
print('data: ', data)
print('weights: ', ws)
print('weighted data: ', weighted_data)
print('weighted avg: ', sum(weighted_data))
Пакет для анализа временных рядов в python