始める無料で始める

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.

この演習はコースの一部です

Analyzing IoT Data in Python

コースを見る

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Resample DataFrame to 1h
df_seas = df.resample('1h').max()

# Run seasonal decompose
decomp = ____
コードを編集して実行