Skip to content

Instantly share code, notes, and snippets.

@asherp
Created June 15, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asherp/2fb5cd71c91609d3b0821dd92fd6a036 to your computer and use it in GitHub Desktop.
Save asherp/2fb5cd71c91609d3b0821dd92fd6a036 to your computer and use it in GitHub Desktop.
windowed time average
def windowed_time_average(data, window = 3):
window = 3
results = []
for i in range(len(data)):
if i < window:
results.append(np.sum(data[:i+1])/window)
else:
results.append(np.sum(data[i-window+1:i+1])/window)
return np.array(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment