text_html_output_1.png text_plain_output_1.png
import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

train_data = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
test_data = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv')
submission_file = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/submission.csv')

(train_data.shape, test_data.shape, submission_file.shape)

train_data_covid = train_data.copy()
test_data_covid = test_data.copy()
test_data_covid = test_data_covid.fillna('NA')
train_data_covid = train_data_covid.fillna('NA')

train_series_cc = train_data_covid.fillna('NA').groupby(['Country_Region', 'Province_State', 'Date'])['ConfirmedCases'].sum().groupby(['Country_Region', 'Province_State']).max().sort_values().groupby('Country_Region').sum().sort_values(ascending=False)
train_series_fatal = train_data_covid.fillna('NA').groupby(['Country_Region', 'Province_State', 'Date'])['Fatalities'].sum().groupby(['Country_Region', 'Province_State']).max().sort_values().groupby('Country_Region').sum().sort_values(ascending=False)

train_series_date = train_data_covid.groupby(['Date'])[['ConfirmedCases']].sum().sort_values('ConfirmedCases')
display(train_series_date.head())
train_series_date_fata = train_data_covid.groupby(['Date'])[['Fatalities']].sum().sort_values('Fatalities')
display(train_series_date_fata.head())