Assignment 7 Covid 19 .Ipynb - Colab
Assignment 7 Covid 19 .Ipynb - Colab
ipynb - Colab
Vaibhav Avinashe
ADT24MGTM0639
Assignment 7
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
df=pd.read_csv("/content/drive/MyDrive/datasets/day_wise.csv")
df
New New New Deaths / 100 Recovered / 100 Deaths / 100 No. of
Date Confirmed Deaths Recovered Active
cases deaths recovered Cases Cases Recovered countries
2020-
0 555 17 28 510 0 0 0 3.06 5.05 60.71 6
01-22
2020-
1 654 18 30 606 99 1 2 2.75 4.59 60.00 8
01-23
2020-
2 941 26 36 879 287 8 6 2.76 3.83 72.22 9
01-24
2020-
3 1434 42 39 1353 493 16 3 2.93 2.72 107.69 11
01-25
2020-
4 2118 56 52 2010 684 14 13 2.64 2.46 107.69 13
01-26
... ... ... ... ... ... ... ... ... ... ... ... ...
2020-
183 15510481 633506 8710969 6166006 282756 9966 169714 4.08 56.16 7.27 187
07-23
2020-
184 15791645 639650 8939705 6212290 281164 6144 228736 4.05 56.61 7.16 187
07-24
2020-
185 16047190 644517 9158743 6243930 255545 4867 219038 4.02 57.07 7.04 187
07-25
2020-
186 16251796 648621 9293464 6309711 204606 4104 134721 3.99 57.18 6.98 187
07-26
2020-
187 16480485 654036 9468087 6358362 228693 5415 174623 3.97 57.45 6.91 187
07-27
https://colab.research.google.com/drive/1pFNp-vZIlqOExElkrY8r-4-UJUyRX4N5#scrollTo=UblAY-gAmRLz&printMode=true 1/6
4/14/25, 6:36 PM Assignment 7 Covid 19 .ipynb - Colab
Next steps: Generate code with df toggle_off View recommended plots New interactive sheet
df.shape
(188, 12)
df.isnull().sum()
Date 0
Confirmed 0
Deaths 0
Recovered 0
Active 0
New cases 0
New deaths 0
New recovered 0
No. of countries 0
dtype: int64
plt.figure(figsize=(20,10))
sns.lineplot(x='Date', y='Confirmed', data=df)
plt.title('Daily Confirmed COVID-19 Cases')
plt.xlabel('Date')
plt.ylabel('Number of Cases')
plt.xticks(rotation=45)
plt.show()
https://colab.research.google.com/drive/1pFNp-vZIlqOExElkrY8r-4-UJUyRX4N5#scrollTo=UblAY-gAmRLz&printMode=true 2/6
4/14/25, 6:36 PM Assignment 7 Covid 19 .ipynb - Colab
df2=pd.read_csv("/content/drive/MyDrive/datasets/worldometer_data.csv")
(QUE 2)Use scatter plots to visualize the relationship between testing and cases.
https://colab.research.google.com/drive/1pFNp-vZIlqOExElkrY8r-4-UJUyRX4N5#scrollTo=UblAY-gAmRLz&printMode=true 3/6
4/14/25, 6:36 PM Assignment 7 Covid 19 .ipynb - Colab
plt.figure(figsize=(10,5))
plt.scatter(df2['TotalCases'], df2['TotalTests'])
plt.title('Relationship between Testing and Cases')
plt.xlabel('Number of Cases')
plt.ylabel('Number of Tests')
plt.figure(figsize=(10, 5))
plt.hist(df['Deaths'], bins=30, color='#8B0000', alpha=0.7, edgecolor='white')
plt.title('Distribution of Daily COVID-19 Deaths', fontsize=14)
plt.xlabel('Number of Daily Deaths', fontsize=12)
plt.ylabel('Frequency', fontsize=12)
plt.legend()
plt.grid(axis='y', alpha=0.3)
plt.tight_layout()
plt.show()
https://colab.research.google.com/drive/1pFNp-vZIlqOExElkrY8r-4-UJUyRX4N5#scrollTo=UblAY-gAmRLz&printMode=true 4/6
4/14/25, 6:36 PM Assignment 7 Covid 19 .ipynb - Colab
<ipython-input-11-b2e61ffe5287>:6: UserWarning: No artists with labels found to put in legend. Note that artists whose label start with an underscore ar
plt.legend()
df['Date']=pd.to_datetime(df['Date'])
df['Month']=df['Date'].dt.month
df['Year']=df['Date'].dt.year
plt.figure(figsize=(10, 7))
sns.boxplot(x='Month',y='Deaths',data=df)
plt.title('Monthly COVID-19 Death Rates', fontsize=14)
plt.xlabel('Month', fontsize=12)
plt.ylabel('Number of Deaths', fontsize=12)
https://colab.research.google.com/drive/1pFNp-vZIlqOExElkrY8r-4-UJUyRX4N5#scrollTo=UblAY-gAmRLz&printMode=true 5/6
4/14/25, 6:36 PM Assignment 7 Covid 19 .ipynb - Colab
https://colab.research.google.com/drive/1pFNp-vZIlqOExElkrY8r-4-UJUyRX4N5#scrollTo=UblAY-gAmRLz&printMode=true 6/6