1. Learn
  2. /
  3. Courses
  4. /
  5. Analyzing IoT Data in Python

Connected

Exercise

Seasonal decomposition II

Let's now have a look at how we can detect and visualize seasonality and trends in the environment data.

You'll be using statsmodels.seasonal_decompose() to do the decomposition then plot the results.

You will also resample the data to an hourly interval to see longer trends. Choosing a too short interval will prevent us from seeing clear trends and seasonalities.

matplotlib.pyplot as plt and import statsmodels.api as sm have been imported for you and the data has been loaded for you as df.

Instructions 1/3

undefined XP
    1
    2
    3
  • Run seasonal decomposition on the resampled DataFrame and assign it to decomp.