问题描述
我正在尝试将 ARMA 模型拟合到存储在 pandas 数据框中的时间序列.数据框有一列名为val"的 numpy.float64 类型的值和一个 pandas 时间戳索引.时间戳采用年-月-日时:分:秒"格式.我理解以下代码:
I am trying to fit an ARMA model to a time series stored in a pandas dataframe. The dataframe has one column of values of type numpy.float64 named "val" and an index of pandas timestamps. The timestamps are in the "Year-Month-Day Hour:Minute:Second" format. I understand that the following code:
给我错误信息:
因为我没有正确格式化时间戳.如何索引我的数据帧,以便 ARMA 方法接受它,同时保留我的日期和时间信息?
because I have not formatted the timestamps correctly. How can I index my dataframe so that the ARMA method accepts it while retaining my date and time information?
推荐答案
我认为你需要将 index
转换为 DatetimeIndex
:
I think you need convert index
to DatetimeIndex
:
示例:
这篇关于将ARMA模型拟合到python中按时间索引的时间序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!