Ошибка при попытке составить субплот с использованием прогнозирования пророка - Python - PullRequest
0 голосов
/ 16 апреля 2020

Я пытаюсь построить подзаговоры со следующим кодом:

fig,axs = plt.subplots(nrows=2, ncols=2)

regions = ['test1', 'test2', 'test3', 'test4']

for i in regions:
    total = raw.loc[i].sum(axis = 1).reset_index()

    total['count_date'] = pd.to_datetime(total['count_date'])
    total               = total.rename(columns = {'count_date': 'ds', 0: 'y'})
    total['y']          = total['y'] + 1e-4

    m  = Prophet(growth = 'linear')
    m.fit(total)
    future = m.make_future_dataframe(periods = 3652)

    forecast = m.predict(future)
    forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']]

    fig = m.plot(forecast,ax = ax[i], xlabel = 'Year', ylabel = 'Total Cycles')

, но получаю следующую ошибку:

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

...