![](/img/trans.png)
[英]Code seasonal_decompose from statsmodels with only native python
[英]How to access components of seasonal_decompose from statsmodels
我有兩個時間序列存儲在相同長度和相同列的london
和scotland
數據幀中。 date
中的一列跨度從 2009 年到 2019 年,並且對列yearly_cost
數據具有每日頻率。 它們看起來是這樣的:
Date Yearly_cost
0 2009-01-01 230
1 2009-01-02 460
2 2009-01-03 260
3 2009-01-04 250
4 2009-01-05 320
5 2009-01-06 430
我希望只比較時間序列中yearly_cost
的季節性分量的歐幾里德距離。 我已經使用 statsmodels 中的seasonal_decompose()
分解了它們,但是我希望只從對象中獲取季節性組件:
result = <statsmodels.tsa.seasonal.DecomposeResult at 0x2b5d7d2add8>
這是否可以在new_df
采用並創建到時間序列中?
任何幫助,將不勝感激。 謝謝
我已經解決了這個問題。 要獲得季節性成分,您只需使用
new_df = result.seasonal
這只會為您提供季節性結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.