0

I'm trying to forecast with SARIMA model but it keeps showing

'numpy.ndarray' object has no attribute 'plot'

Does anyone know how to solve it?

ax = monthly_mean['2016':].plot(label='observed')
predictions.predicted_mean.plot(ax=ax, label='One-step ahead Forecast', alpha=.7)
ax.fill_between(pred_ci.index,
 pred_ci.iloc[:, 0],
 pred_ci.iloc[:, 1], color='k', alpha=.2)
ax.set_xlabel('Date')
ax.set_ylabel('CO2 Levels')
plt.legend()
plt.show()
Mad Physicist
115k29 gold badges201 silver badges291 bronze badges
asked May 26, 2022 at 22:41
3
  • 3
    You need to plot a dataframe, not a numpy array. Commented May 26, 2022 at 22:43
  • 1
    Apparently predictions.predicted_mean is an array. Array can be passed as an argument to plt.plot. It does not have a plot method. What made you think that was possible? Commented May 26, 2022 at 23:33
  • Does this answer your question? Prob using axes for subplot an get AttributeError: 'numpy.ndarray' object has no attribute 'plot' Commented Apr 8, 2024 at 13:25

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.