Skip to content

Instantly share code, notes, and snippets.

@kashefy kashefy/moving_avg.py
Last active Jul 29, 2016

Embed
What would you like to do?
Moving average for a time series
import numpy as np
def moving_avg(x, window_size):
window = np.ones(int(window_size)) / float(window_size)
return np.convolve(x, window, 'valid')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.