1

我正在寻找使用可在此处下载的天然气季节性数据构建 ARMA 模型。

所以:

import statsmodels.api as sm
import pandas as pd
df = pd.read_csv('/Path/To/WSJ-NG_HH.csv')
In [86]: df.head
Out[86]: 
<bound method DataFrame.head of            Date   Value
0    2015-10-31   2.100
1    2015-09-30   2.470
2    2015-08-31   2.680
3    2015-07-31   2.770
4    2015-06-30   2.770

接下来我np.asarray()在 DataFrame 上应用 data =:

data = np.asarray(df)

然后实例化ARMA

arma = sm.tsa.ARMA(data, order =(4,4))

当我尝试适应时:

results = arma.fit(full_output=False, disp=0)

我得到:

/Users/Pyderman/anaconda/lib/python2.7/site-packages/statsmodels/regression/linear_model.pyc in fit(self, method, cov_type, cov_kwds, use_t, **kwargs)
    180                 self.rank = np_matrix_rank(np.diag(singular_values))
    181 
--> 182             beta = np.dot(self.pinv_wexog, self.wendog)
    183 
    184         elif method == "qr":

TypeError: can't multiply sequence by non-int of type 'float'

必须做什么才能处理数据中的浮点值?

统计模型版本:0.6.1

4

0 回答 0