0% found this document useful (0 votes)
13 views4 pages

COVID19.ipynb - Colab

The document contains a Python script that analyzes COVID-19 data from a CSV file sourced from Our World in Data. It includes data manipulation using pandas, visualization of daily new cases and total vaccinations in India, and a comparison of daily new cases between India and the United States. The script utilizes libraries such as pandas, numpy, matplotlib, and seaborn for data handling and visualization.

Uploaded by

megha.s238156202
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

COVID19.ipynb - Colab

The document contains a Python script that analyzes COVID-19 data from a CSV file sourced from Our World in Data. It includes data manipulation using pandas, visualization of daily new cases and total vaccinations in India, and a comparison of daily new cases between India and the United States. The script utilizes libraries such as pandas, numpy, matplotlib, and seaborn for data handling and visualization.

Uploaded by

megha.s238156202
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

import pandas as pd

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

url = 'https://covid.ourworldindata.org/data/owid-covid-data.csv'
df = pd.read_csv(url)

df.head()

iso_code continent location date total_cases new_cases new_cases_smoothed total_deaths

2020-
0 AFG Asia Afghanistan 0.0 0.0 NaN 0.0
01-05

2020-
1 AFG Asia Afghanistan 0.0 0.0 NaN 0.0
01-06

2020-
2 AFG Asia Afghanistan 0.0 0.0 NaN 0.0
01-07

2020-
3 AFG Asia Afghanistan 0.0 0.0 NaN 0.0
01-08

2020-
4 AFG Asia Afghanistan 0.0 0.0 NaN 0.0
01-09

5 rows × 67 columns

df.info()
df.describe()
<class 'pandas.core.frame.DataFrame'> 
RangeIndex: 429435 entries, 0 to 429434
Data columns (total 67 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 iso_code 429435 non-null object
1 continent 402910 non-null object
2 location 429435 non-null object
3 date 429435 non-null object
4 total_cases 411804 non-null float64
5 new_cases 410159 non-null float64
6 new_cases_smoothed 408929 non-null float64
7 total_deaths 411804 non-null float64
8 new_deaths 410608 non-null float64
9 new_deaths_smoothed 409378 non-null float64
10 total_cases_per_million 411804 non-null float64
11 new_cases_per_million 410159 non-null float64
12 new_cases_smoothed_per_million 408929 non-null float64
13 total_deaths_per_million 411804 non-null float64
14 new_deaths_per_million 410608 non-null float64
15 new_deaths_smoothed_per_million 409378 non-null float64
16 reproduction_rate 184817 non-null float64
17 icu_patients 39116 non-null float64
18 icu_patients_per_million 39116 non-null float64
19 hosp_patients 40656 non-null float64
20 hosp_patients_per_million 40656 non-null float64
21 weekly_icu_admissions 10993 non-null float64
22 weekly_icu_admissions_per_million 10993 non-null float64
23 weekly_hosp_admissions 24497 non-null float64
24 weekly_hosp_admissions_per_million 24497 non-null float64
25 total_tests 79387 non-null float64
26 new_tests 75403 non-null float64
27 total_tests_per_thousand 79387 non-null float64
28 new_tests_per_thousand 75403 non-null float64
29 new_tests_smoothed 103965 non-null float64
30 new_tests_smoothed_per_thousand 103965 non-null float64
31 positive_rate 95927 non-null float64
32 tests_per_case 94348 non-null float64
33 tests_units 106788 non-null object
34 total_vaccinations 85417 non-null float64
35 people_vaccinated 81132 non-null float64
36 people_fully_vaccinated 78061 non-null float64
37 total_boosters 53600 non-null float64
38 new_vaccinations 70971 non-null float64
39 new_vaccinations_smoothed 195029 non-null float64
40 total_vaccinations_per_hundred 85417 non-null float64
41 people_vaccinated_per_hundred 81132 non-null float64
42 people_fully_vaccinated_per_hundred 78061 non-null float64
43 total_boosters_per_hundred 53600 non-null float64
44 new_vaccinations_smoothed_per_million 195029 non-null float64
45 new_people_vaccinated_smoothed 192177 non-null float64
46 new_people_vaccinated_smoothed_per_hundred 192177 non-null float64
47 stringency_index 196190 non-null float64
48 population_density 360492 non-null float64
49 median_age 334663 non-null float64
50 aged_65_older 323270 non-null float64
51 aged_70_older 331315 non-null float64
52 gdp_per_capita 328292 non-null float64
53 extreme_poverty 211996 non-null float64
54 cardiovasc_death_rate 328865 non-null float64
55 diabetes_prevalence 345911 non-null float64
56 female_smokers 247165 non-null float64
57 male_smokers 243817 non-null float64
58 handwashing_facilities 161741 non-null float64
59 hospital_beds_per_thousand 290689 non-null float64
60 life_expectancy 390299 non-null float64
61 human_development_index 319127 non-null float64
62 population 429435 non-null int64
63 excess_mortality_cumulative_absolute 13411 non-null float64
64 excess_mortality_cumulative 13411 non-null float64
65 excess_mortality 13411 non-null float64
66 excess_mortality_cumulative_per_million 13411 non-null float64
dtypes: float64(61), int64(1), object(5)
memory usage: 219.5+ MB
total_cases new_cases new_cases_smoothed total_deaths new_deaths new_deaths_smo

count 4.118040e+05 4.101590e+05 4.089290e+05 4.118040e+05 410608.000000 409378.0

mean 7.365292e+06 8.017360e+03 8.041026e+03 8.125957e+04 71.852139 72.0

std 4.477582e+07 2.296649e+05 8.661611e+04 4.411901e+05 1368.322990 513.6

min 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000 0.0

25% 6.280750e+03 0.000000e+00 0.000000e+00 4.300000e+01 0.000000 0.0

50% 6.365300e+04 0.000000e+00 1.200000e+01 7.990000e+02 0.000000 0.0

75% 7.582720e+05 0.000000e+00 3.132860e+02 9.574000e+03 0.000000 3.1

max 7.758668e+08 4.423623e+07 6.319461e+06 7.057132e+06 103719.000000 14817.0

8 rows × 62 columns

pen_spark Generate 10 random numbers using numpy search Close

india_df = df[df['location'] == 'India']

plt.figure(figsize=(12,6))
plt.plot(india_df['date'], india_df['new_cases'], label='Daily New Cases')
plt.title('Daily New COVID-19 Cases in India')
plt.xlabel('Date')
plt.ylabel('Number of Cases')
plt.legend()
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
plt.figure(figsize=(12,6))
plt.plot(india_df['date'], india_df['total_vaccinations'], color='green', label='Total Vaccinations')
plt.title('Total COVID-19 Vaccinations in India')
plt.xlabel('Date')
plt.ylabel('Number of Vaccinations')
plt.legend()
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

countries = ['India', 'United States']


plt.figure(figsize=(12,6))
for country in countries:
country_df = df[df['location'] == country]
plt.plot(country_df['date'], country_df['new_cases'], label=country)
plt.title('Daily New COVID-19 Cases: India vs United States')
plt.xlabel('Date')
plt.ylabel('Number of Cases')
plt.legend()
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

You might also like