text_plain_output_1.png
import matplotlib.pyplot as plt

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))) 

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 8))
fig.suptitle('Number of Confirmed Cases and Fatalities in the World', fontsize=30)
ax1.bar(train_large10_cc.index, train_large10_cc['ConfirmedCases'], color='purple')
ax1.set(xlabel='Countries', ylabel='Number of ConfirmedCases')
ax1.legend(['ConfirmedCases'])
ax1.grid()
ax2.bar(train_large10_fatal.index, train_large10_fatal['Fatalities'], color='orange')
ax2.set(xlabel='Countries', ylabel='Number of Fatalities')
ax2.legend(['Fatalities'])
ax2.grid()
plt.rcParams['font.family'] = 'Times New Roman'
plt.rcParams['font.size'] = '20'
plt.show()