OutOfBoundsDatetime:超出范围的纳秒级时间戳记

问题描述 投票:0回答:1

我正在使用GluonTS解决时间序列问题。

data = common.ListDataset([{"start": df.index[0],
                            "target": df.price[:"2021-12-01"]}],
                             freq="1M")

我在上一行遇到此错误

8866-12-31 00:00:00:超出范围的纳秒级时间戳:8866-12-31 00:00:00

我已经检查了数据帧df,并且它只有从2017年到2021年的时间戳。

这是df.index的样子:

DatetimeIndex(['2017-02-01', '2017-03-01', '2017-04-01', '2017-05-01',
               '2017-06-01', '2017-07-01', '2017-08-01', '2017-09-01',
               '2017-10-01', '2017-11-01',
               ...
               '2020-12-01', '2021-01-01', '2021-02-01', '2021-03-01',
               '2021-04-01', '2021-05-01', '2021-06-01', '2021-07-01',
               '2021-08-01', '2021-09-01'],
              dtype='datetime64[ns]', length=82198, freq=None)

我不了解基于我的数据的错误。

python time-series
1个回答
0
投票

我认为可能是df.index[0]。似乎其8866将被解释为年份。尝试提供一个时间戳记作为开始,如文档所述:“开始:时间序列的开始日期”

© www.soinside.com 2019 - 2024. All rights reserved.