使用series.groupby NamedAggdf_agg = df.groupby('status').file_name.agg(file_name='first', count='count').reset_index()Out[393]: status file_name count0 final my_movie.mov 1718045 我试图通过 StatsModels ETSModel 从 Holt Winters 时间序列模型获取预测区间。有人可以帮我弄清楚出了什么问题吗?fit1 = ETSModel(x_train, seasonal_periods=7, trend='add', seasonal='mul', damped_trend=True).fit()fcst = fit1.get_prediction(start=current_date, end=current_date + np.timedelta64(6,'D'))我收到以下错误:File "C:\ProgramData\Anaconda3\lib\site-packages\statsmodels\tsa\exponential_smoothing\ets.py", line 2078, in get_prediction **simulate_kwargs, File "C:\ProgramData\Anaconda3\lib\site-packages\statsmodels\tsa\exponential_smoothing\ets.py", line 2234, in __init__ start : (end + 1)ValueError: could not broadcast input array from shape (0) into shape (7)这是输入:x_trainOut[24]: ds2020-08-04 1027.02020-08-05 1813.02020-08-06 2157.02020-08-07 3070.02020-08-08 2968.02020-08-09 2083.02020-08-10 1762.02020-08-11 1755.02020-08-12 1788.02020-08-13 2266.02020-08-14 3272.02020-08-15 2768.02020-08-16 1869.02020-08-17 1940.02020-08-18 1673.02020-08-19 1821.02020-08-20 2293.02020-08-21 2802.02020-08-22 2604.02020-08-23 1843.02020-08-24 1758.02020-08-25 1393.02020-08-26 1612.02020-08-27 2165.02020-08-28 2898.02020-08-29 2471.02020-08-30 2297.0Freq: D, dtype: float64current_dateOut[25]: numpy.datetime64('2020-09-01')
1 回答
30秒到达战场
TA贡献1828条经验 获得超6个赞
get_prediction
如果开始日期在数据集结束之后,这看起来像是一个错误。我建议您在https://github.com/statsmodels/statsmodels/issues/new?template=bug_report.md提交错误报告。
与此同时,您似乎需要将数据设置start
为等于数据集中的最后日期(例如,在您给出的示例中为 2020-08-30),然后手动将结果子集化为仅来自current_date
向前的结果。
添加回答
举报
0/150
提交
取消