Simple and Weighted Moving Averages

easy
Unit 7 · Economics0/3 to milestone

Implement, for a window k, arrays of the same length as the input with NaN for the first k - 1 positions:

  • sma(x, k): simple moving average
  • wma(x, k): linearly weighted moving average, with weights 1, 2, ..., k from oldest to newest
#time-series#smoothing2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Simple and Weighted Moving Averages · TechGradify