0
respostas

Prevendo e Comparando - Erro no gráfico

Boa noite! Ao plotar o gráfico, o mesmo ficou diferente do mostrado na aula e apresentou o seguinte erro:

TypeError                                 Traceback (most recent call last)
<ipython-input-50-33acd3553dec> in <module>
      3 ax = y.plot(label= 'Observado', figsize=(14,7))
      4 pred_uc.predicted_mean.plot(ax=ax, label='Previsto')
----> 5 ax.fill_between(pred_ic.index, pred_ic.iloc[:,0], pred_ic.iloc[:,1], color='k', alpha='0.25')
      6 ax.set_xlabel('Data')
      7 ax.set_ylabel('Casos de COVID-19')

8 frames
/usr/local/lib/python3.7/dist-packages/matplotlib/artist.py in set_alpha(self, alpha)
    930         """
    931         if alpha is not None and not isinstance(alpha, Number):
--> 932             raise TypeError('alpha must be a float or None')
    933         self._alpha = alpha
    934         self.pchanged()

TypeError: alpha must be a float or None

O código que teve esse retorno foi:

pred_uc = results.get_forecast(steps=150)
pred_ic = pred_uc.conf_int()
ax = y.plot(label= 'Observado', figsize=(14,7))
pred_uc.predicted_mean.plot(ax=ax, label='Previsto')
ax.fill_between(pred_ic.index, pred_ic.iloc[:,0], pred_ic.iloc[:,1], color='k', alpha='0.25')
ax.set_xlabel('Data') 
ax.set_ylabel('Casos de COVID-19') 
plt.show()