'我想使用X13的Arima季节性化一些数据,但是总是出现这样的问题:'
import pandas as pd
import statsmodels.api as sm
import os import numpy as np
base_data=pd.read_excel('J:\Economics\database\Brasil\economic growth',
sheetname='Dados NSA (2)',
parse_dates = [0],
index_col= [0])
PATH =r'J:\Eco\x13as'
os.chdir(PATH)
dfs = pd.DataFrame([])
cielo = base_dessaz.CIELO
cielo.replace('-', np.nan , inplace=True)
cielo.dropna(inplace=True)
cielo_sa = sm.tsa.x13_arima_analysis(cielo).seasadj
cielo_sa.name = 'cielo_sa'
dfs = pd.concat([dfs, cielo_sa], axis=1)
lgn_sa = sm.tsa.x13_arima_analysis(base_dessaz.LGN, outlier=False).seasadj
lgn_sa.name = 'lgn_sa'
dfs = pd.concat([dfs, lgn_sa], axis=1)
gas_sa = sm.tsa.x13_arima_analysis(base_dessaz.GAS).seasadj
gas_sa.name = 'gas_sa'
dfs = pd.concat([dfs, gas_sa], axis=1)
ipi_sa = sm.tsa.x13_arima_analysis(base_dessaz.IPI).seasadj
ipi_sa.name = 'ipi_sa'
dfs = pd.concat([dfs, ipi_sa], axis=1)
writer = pd.ExcelWriter('J:/Eco/database/Brasil/Atividade/BrasilEconomic.xlsx')
dfs.to_excel(writer, 'Dessaz')
writer.save()
file = "J:/Eco_Asset/database/Brasil/Atividade/BrasilEconomic.xlsx"
os.startfile(file)
使用此代码时,此提示:
文件 “ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ tsa \ x13.py”, 第180行,在_check_errors中 引发X13Error(errors)
X13错误:第173行:nan ^错误:预期实数不是“ nan”
第202行:transform {function = auto} ^错误:在用户定义的调整之前指定系列