text_plain_output_1.png image_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

import os

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

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
plt.style.use('fivethirtyeight')

full_table = pd.read_csv('/kaggle/input/novel-corona-virus-2019-dataset/covid_19_data.csv', parse_dates=['ObservationDate'])

italy = pd.DataFrame(full_table[full_table['Country/Region'] == 'Italy'])
france = pd.DataFrame(full_table[full_table['Country/Region'] == 'France'])
germany = pd.DataFrame(full_table[full_table['Country/Region'] == 'Germany'])
uk = pd.DataFrame(full_table[full_table['Country/Region'] == 'UK'])
spain = pd.DataFrame(full_table[full_table['Country/Region'] == 'Spain'])
turkey = pd.DataFrame(full_table[full_table['Country/Region'] == 'Turkey'])

fig, ax = plt.subplots(figsize=(15,7))
ax.set_xlabel("Observation Date")
ax.set_ylabel("Count of Confirmed Positive Cases, Deaths, and Recoveries")

italy[['ObservationDate','Confirmed','Deaths','Recovered']].plot(x='ObservationDate',kind='line',ax=ax, title="Tracking Corona Virus in Italy")
fig, ax = plt.subplots(figsize=(15,7))
ax.set_xlabel("Observation Date")
ax.set_ylabel("Count of Confirmed Positive Cases, Deaths, and Recoveries")

germany[['ObservationDate','Confirmed','Deaths','Recovered']].plot(x='ObservationDate',kind='line',ax=ax, title="Tracking Corona Virus in Germany")
fig, ax = plt.subplots(figsize=(15,7))
ax.set_xlabel("Observation Date")
ax.set_ylabel("Count of Confirmed Positive Cases, Deaths, and Recoveries")

spain[['ObservationDate','Confirmed','Deaths','Recovered']].plot(x='ObservationDate',kind='line',ax=ax, title="Tracking Corona Virus in Spain")

fig, ax = plt.subplots(figsize=(15,7))
ax.set_xlabel("Observation Date")
ax.set_ylabel("Count of Confirmed Positive Cases, Deaths, and Recoveries")

italy[['ObservationDate','Confirmed','Deaths']].plot(x='ObservationDate',kind='line',ax=ax, title="Tracking Corona Virus cases, deaths in Italy, Germany and Spain")
germany[['ObservationDate','Confirmed','Deaths']].plot(x='ObservationDate',kind='line',ax=ax)
spain[['ObservationDate','Confirmed','Deaths']].plot(x='ObservationDate',kind='line',ax=ax)
ax.legend(['Confirmed Cases in Italy','Confirmed Deaths in Italy',
           'Confirmed Cases in Germany','Confirmed Deaths in Germany',
          'Confirmed Cases in Spain','Confirmed Deaths in Spain'])

fig, ax = plt.subplots(figsize=(15,7))
ax.set_xlabel("Observation Date")
ax.set_ylabel("Count of Confirmed Positive Cases, Deaths, and Recoveries")

turkey[['ObservationDate','Confirmed','Deaths','Recovered']].plot(x='ObservationDate',kind='line',ax=ax, title="Tracking Corona Virus in Turkey")

uk_agg=pd.pivot_table(uk, index=['ObservationDate'],values=['Confirmed','Deaths','Recovered'],aggfunc=np.sum)
#uk_agg
fig, ax = plt.subplots(figsize=(15,7))
plt.plot(uk_agg.index,uk_agg.values)
plt.legend(['Confirmed','Deaths','Recovered'])
plt.title("Tracking Corona Virus in United Kingdom")
plt.ylabel('Count of Confirmed Positive Cases, Deaths, and Recoveries')
plt.xticks(rotation=90)

uk_agg['Death Rate in United Kingdom'] = uk_agg['Deaths'] / uk_agg['Confirmed'] * 100
uk_agg['Recovery Rate in United Kingdom'] = uk_agg['Recovered'] / uk_agg['Confirmed'] * 100

uk_agg.sample(10)