text_html_output_1.png
from fbprophet import Prophet

import pandas as pd

import pandas as pd

import plotly.graph_objects as go

covid_data = pd.read_excel('/kaggle/input/corona-virus-pakistan-dataset-2020/COVID_FINAL_DATA.xlsx')

covid_data.isnull().sum()

covid_data.dtypes

covid_data['Date'] = pd.to_datetime(covid_data['Date'])

pak_data = covid_data.copy()

deaths = pak_data['Expired'].values.tolist()
data = pd.DataFrame(columns = ['ds','y'])
data['ds'] = list(pak_data['Date'].unique())
data['y'] = deaths

prop=Prophet()
prop.fit(data)
future=prop.make_future_dataframe(periods=15)
prop_forecast=prop.predict(future)
forecast = prop_forecast[['ds','yhat']].tail(15)

fig = go.Figure()
fig.add_trace(go.Scatter(x=pak_data['Date'], y=pak_data['Expired'],
                    mode='lines+markers',marker_color='green',name='Actual'))
fig.add_trace(go.Scatter(x=prop_forecast['ds'], y=prop_forecast['yhat_upper'],
                    mode='lines+markers',marker_color='red',name='Predicted'))
fig.update_layout(title_text = 'Death Cases (Predicted vs Actual) using Prophet')
fig.update_layout(plot_bgcolor='rgb(275, 270, 273)',width=1000, height=600)
fig.show()

data