Exercise
Just as we extracted the time series code into its own class, we can also extract the moving average code into a separate class. Try doing this refactoring as an exercise. Once you are done, check out the Appendix for a walkthrough of one possible solution.
Get Test-Driven Python Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.