Created
September 15, 2021 15:53
-
-
Save ugo-nama-kun/89e185d6e15143e9092955187776ff76 to your computer and use it in GitHub Desktop.
Simple Moving Average
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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