# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import numpy as np

df = pd.read_csv("C:/Users/avakh/Desktop/sml_4_data/data/countries-aggregated_csv.csv")

df.head()

df1=df.loc[df['Country'] =='Costa Rica']

df2=df1[['Date','Confirmed']]

df2.reset_index(drop=True, inplace=True)

df2.set_index('Date',inplace=True)

from statsmodels.tsa.arima_model import ARIMA

# +
import statsmodels.api as sm

import matplotlib.pyplot as plt
# -

import statsmodels.api as sm
model=sm.tsa.statespace.SARIMAX(df2['Confirmed'],order=(1, 1, 1),seasonal_order=(1,1,1,12))
results=model.fit()

l1=results.predict(start=552,end=600,dynamic=True)


l1

df2

type(l1)

l1.to_frame()

frames = [df2, l1]

result = pd.concat(frames)

result



result[['Confirmed',0]].plot(figsize=(12,8))

df7=df.loc[df['Country'] =='Afghanistan']

df8=df7[['Date','Deaths']]

df8.reset_index(drop=True, inplace=True)

df8.set_index('Date',inplace=True)

import statsmodels.api as sm
model=sm.tsa.statespace.SARIMAX(df8['Deaths'],order=(1, 1, 1),seasonal_order=(1,1,1,12))
results=model.fit()

l2=results.predict(start=552,end=600,dynamic=True)

l2.to_frame()

frames = [df8, l2]

result = pd.concat(frames)

result[['Deaths',0]].plot(figsize=(12,8))



StarcoderdataJupyterScriptsDedupFiltered