1. Learn
  2. /
  3. Courses
  4. /
  5. Anomaly Detection in Python

Exercise

Practicing decomposition

Decomposition will be an essential part of your toolbox when working with time series.

In this exercise, you will practice seasonal decomposition. The apple stocks dataset has already been loaded for you, along with matplotlib as plt.

Instructions 1/4

undefined XP
  • 1
    • Create a DecomposeResult object on the Volume column. Only choose the range from 2010 to 2012.
    • Set the period to 365 while creating DecomposeResult.
    • Plot the seasonality with a figsize of (12, 4) and in red color.
  • 2
    • Plot the trend in red.
  • 3
    • Plot the residuals in red.
  • 4
    • Plot all three components of DecomposeResult object and save the figure into fig.