You will write a function that finds the moving averages of a time series for any number of points, and use it to see which length removes a seasonal swing.
The idea. A -point moving average is the mean of values in a row. Then the run moves on by one value. A list of values gives averages.
Your tasks.
moving_averages(data, k). Return the list of -point moving averages.spread(values). Return the largest value minus the smallest.best_length(data, choices). Return the length in choices whose moving averages have the smallest spread.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…