Skip to content

Instantly share code, notes, and snippets.

@ugo-nama-kun
Created September 15, 2021 15:53
Show Gist options
  • Save ugo-nama-kun/89e185d6e15143e9092955187776ff76 to your computer and use it in GitHub Desktop.
Save ugo-nama-kun/89e185d6e15143e9092955187776ff76 to your computer and use it in GitHub Desktop.
Simple Moving Average
# From: https://stackoverflow.com/questions/14313510/how-to-calculate-rolling-moving-average-using-python-numpy-scipy
def moving_average(x: np.array, w: int):
return np.convolve(x, np.ones(w), 'valid') / w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment