使用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 時(shí)間序列模型獲取預(yù)測(cè)區(qū)間。有人可以幫我弄清楚出了什么問題嗎?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'))我收到以下錯(cuò)誤: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秒到達(dá)戰(zhàn)場(chǎng)
TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超6個(gè)贊
get_prediction
如果開始日期在數(shù)據(jù)集結(jié)束之后,這看起來像是一個(gè)錯(cuò)誤。我建議您在https://github.com/statsmodels/statsmodels/issues/new?template=bug_report.md提交錯(cuò)誤報(bào)告。
與此同時(shí),您似乎需要將數(shù)據(jù)設(shè)置start
為等于數(shù)據(jù)集中的最后日期(例如,在您給出的示例中為 2020-08-30),然后手動(dòng)將結(jié)果子集化為僅來自current_date
向前的結(jié)果。
添加回答
舉報(bào)
0/150
提交
取消