季節性分解
在上一個練習中,你透過視覺檢查與自相關圖,一起找出了交通資料中的重複模式。
現在你要把這些資料進一步拆解成各個組成部分。
traffic 已為你載入完成。
本練習屬於課程
使用 Python 分析 IoT 資料
練習說明
- 以
sm匯入statsmodels.api。 - 對 DataFrame
traffic中時間序列欄位"vehicles"執行季節性分解,並將結果指定給res。 - 在畫面上列印季節性組成(seasonal component)。
- 繪製時間序列分解的結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import modules
____
# Perform decompositon
res = sm.tsa.____(____[____])
# Print the seasonal component
____
# Plot the result
____
# Show the plot
plt.show()