File size: 258 Bytes
b5d1dbc | 1 2 3 4 5 6 7 8 | def rolling_mean(values, window):
"""Mean of each full window of `window` consecutive values, in order."""
out = []
for i in range(len(values) - window):
chunk = values[i:i + window]
out.append(sum(chunk) / window)
return out
|