6 examples of 'numpy moving average' in Python

Every line of 'numpy moving average' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
37@property
38def average(self):
39 return self.avg
59def average(average_window, data):
60 window = []
61 newdata = []
62 for v in data:
63 window.append(v)
64 if len(window) == average_window:
65 newdata.append(sum(window)/average_window)
66 del window[0]
67 return newdata
99@property
100def avg(self):
101 return self.wsum / self.sumtime if self.count else None
9def movingaverage(y, window_size):
10 """
11 Moving average function from:
12 http://stackoverflow.com/questions/11352047/finding-moving-average-from-data-points-in-python
13 """
14 window = np.ones(int(window_size))/float(window_size)
15 return np.convolve(y, window, 'same')
218def moving_average(new_val, last_avg, theta=0.95):
219 return round((1-theta) * new_val + theta* last_avg, 2)
376def getAverageAggregator(self):
377 """
378 Get the aggregator for the average
379 """
380 return self._average

Related snippets