所以我已经使用了以前的答案和问题来回答我的问题,但就我而言,我遇到了一些错误,我不知道如何解决它。
最初我已经加载了一个pandas
数据框df = pd.read_excel(fid_data)
,它的内容在下一个命令中检查df.info()
,我得到以下信息:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 118 entries, 0 to 117
Data columns (total 8 columns):
Date 118 non-null datetime64[ns]
MOEX 118 non-null float64
RTS 118 non-null float64
CAC40 118 non-null float64
DAX 118 non-null float64
FTSe100 118 non-null float64
nikkei 118 non-null float64
sp500 118 non-null float64
dtypes: datetime64[ns](1), float64(7)
memory usage: 7.5 KB
当我尝试moex = df.MOEX
使用此命令进行分解时,res = sm.tsa.seasonal_decompose(moex, model='additive')
出现以下错误:
Traceback (most recent call last):
File "Main.py", line 106, in <module>
res = sm.tsa.seasonal_decompose(moex, model='additive')
File "/home/arvaldez/anaconda3/lib/python3.6/site-packages/statsmodels/tsa/seasonal.py", line 68, in seasonal_decompose
_pandas_wrapper, pfreq = _maybe_get_pandas_wrapper_freq(x)
File "/home/arvaldez/anaconda3/lib/python3.6/site-packages/statsmodels/tsa/filters/_utils.py", line 46, in _maybe_get_pandas_wrapper_freq
freq = index.inferred_freq
AttributeError: 'RangeIndex' object has no attribute 'inferred_freq'