text_html_output_2.png 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_large10_cc = pd.DataFrame(train_series_cc).head(10)
display(train_large10_cc.head())
train_large10_fatal = pd.DataFrame(train_series_fatal).head(10)
display(train_large10_fatal.head())
print('Toal number of people infected by Coronavirus in the world from', min(train_data['Date']), 'to', max(train_data['Date']), 'are:', int(sum(train_series_cc)))
print('Toal number of people deceased by cronavirus in the world from', min(train_data['Date']), 'to', max(train_data['Date']), 'are:', int(sum(train_series_fatal)))