【问题标题】:exog = I shouldn't name thisexog = 我不应该命名这个
【发布时间】:2022-01-13 01:33:49
【问题描述】:
forecast = model.get_forecast(50, exog = data1[[***]].iloc[length-60:-10])

我可以为上面 *** 中的内容指定一个不同的名称吗?例如,如下所示。

eelement = 'open',  'high', 'low', 'volume'
forecast = model.get_forecast(50, exog = data1[[eelement]].iloc[length-60:-10])

但我得到一个错误。

if missing == len(indexer):
1297                 axis_name = self.obj._get_axis_name(axis)
-> 1298                 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
1299 
1300             # We (temporarily) allow for some missing keys with .loc, except in

KeyError: "None of [Index([('open', 'high', 'low', 'volume')], dtype='object')] are in the 
[columns]"

【问题讨论】:

    标签: syntax-error sarimax


    【解决方案1】:

    你需要传递一个列表给pandas,试试:

    eelement = ['open',  'high', 'low', 'volume']
    forecast = model.get_forecast(50, exog = data1[eelement].iloc[length-60:-10])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-19
      • 2011-12-24
      • 2011-05-05
      • 1970-01-01
      • 2012-09-22
      • 2013-08-16
      • 2017-10-02
      相关资源
      最近更新 更多