DELHI PUBLIC SCHOOL BUDGAM
ACADEMIC YEAR 2020-21
CORONAVIRUS
Name : Sahil Nissar Bhat
Class : 12th
Stream : Commerce
Subject : Information Practice
Sub Code : 065
Project Guide : Miss. Azka Bazaz
ACKNOWLEDGEMEN
T
Primarily I would thank Allah for being able to complete this
project with success. Then I would thank to my Business Studies
teacher Miss. Azka Bazaz, whose valuable guidance has been
the ones that helped me to patch this project and make a full
proof success. Her suggestions and instructions have served as
the major contributor towards the completion of the project.
Then would be to thank my parents and friends who have
helped me with their valuable suggestions and guidance that
has been helpful in various phases of the completion of the
project
Last but not the least I would like to thank my classmates who
have helped me a lot…
SAHIL NISSAR BHAT
CERTIFICATE
This is certified that the content of this
project entitled “Coronavirus” is done by
Sahil Nissar Bhat of class XII Commerce has
successfully completed the assigned project
under the guidance of Miss. Azka Bazaz
during the academic year 2020-2021
Date:
Ext. Examiner Signature
Teacher’s Signature Principal
Signature
Remarks: -
INDEX
SR. DESCRIPTION PAGE NO.
NO.
1 Pandas 1
2 Data Frame 2
3 Add/Drop/Sorting 3
4 Mean/Mode/Median 4
5 Sum/Count/Variation 5
6 Quantile/Pivoting/Apply 6
7 Head&Tail/Min/Max 7
8 Line/Bar Graph 8-10
9 Pie/Boxplot/Histogram 10-12
MODULES AND SOFTWARE USED
Operating system: - Windows 10 PRO Build 19042.685
Hardware: - Intel(R)Core (TM) i5-3470 CPU @ 3.20GHz, 8.00 GB RAM, x64 operating system.
Software: - Jupyter Notebook (Anaconda3), Microsoft Word 2019
Language: - Python Pandas library, Python Matplotlib library
Overview
Pandas is a Python package providing fast, flexible, and
expressive data structures designed to make working with
“relational” or “labeled” data both easy and intuitive. It aims to
be the fundamental high-level building block for doing
practical, real world data analysis in Python. Additionally, it has
the broader goal of becoming the most powerful and flexible
open-source data analysis / manipulation tool available in any
language. It is already well on its way toward this goal.
Pandas is well suited for many different kinds of data:
Tabular data with heterogeneously-typed columns, as in an
SQL table or Excel spreadsheet
Ordered and unordered (not necessarily fixed-frequency)
time series data.
Arbitrary matrix data (homogeneously typed or
heterogeneous) with row and column labels
Any other form of observational / statistical data sets. The
data actually need not be labeled at all to be placed into a
panda’s data structure
DATAFRAME
# In[1]:
import pandas as pd
import matplotlib.pyplot as pl
import numpy as np
# In[2]:
data=
{ 'TotalCases':[14774167, 9608418,
6534951,2431731,2268552,1699145,1690432,1688939,1454631,1352607,1156770,1
152283,1041846,1016835,970860,805804,801716,765997,587439,569707],
'TotalRecovered':
[8663603,9058822,5744369,1916396,1688352,1650250,1010010,870385,1281955,1
240990,852719,820600,666413,708106,903958,740450,412533,423142,38858,4704
49],
'TotalDeaths':
[285656,139736,175951,42384,54767,46252,60617,58852,39512,37446,108863,186
91,19359,49695,36195,21963,13421,14509,17142,17589],
'ActiveCases':
[5824908,409860,614614,472654,2045433,160250,601425,757702,133164,74150,1
95188,312992,356072,259034,30707,43391,375762,328346,531493,81669]}
# In[3]:
a=pd.DataFrame(data, index=['USA', 'India','Brazil','Russia','France', 'Spain', 'UK',
'Italy', 'Argentina', 'Colombia', 'Mexico', 'Germany', 'Poland', 'Iran', 'Peru', 'SA',
'Ukraine','Turkey', 'Belgium', 'Indonesia'])
# In[4]:
a.index.name='Country'
# In[5]:
print(a)
# Sorting
# In[6]:
sor=a.sort_values(['ActiveCases'], ascending=False)
# In[7]:
print(sor)
# Drop Column
# In[8]:
dro=a.drop(['TotalCases'], axis=1)
# In[9]:
print(dro)
# Add Column
# In[10]:
b=[14774167, 9608418,
6534951,2431731,2268552,1699145,1690432,1688939,1454631,1352607,1156770,1
152283,1041846,1016835,970860,805804,801716,765997,587439,569707]
# In[11]:
dro['TotalCases']=b
# In[12]:
print(dro)
# Mean
# In[13]:
c=a.mean()
print(c)
# In[41]:
d=a['TotalCases'].mean()
print(d)
# Mode
# In[42]:
e=a.mode()
print(e)
# In[43]:
f=a['ActiveCases'].mode()
print(f)
# Median
# In[45]:
g=a.median()
print(g)
# In[46]:
h=a['TotalDeaths'].median()
print(h)
# Sum
# In[47]:
i=a.sum()
print(i)
# In[48]:
j=a['TotalRecovered'].sum()
print(j)
# Count
# In[49]:
k=a.count()
print(k)
# In[50]:
l=a['TotalCases'].count()
print(l)
# Variation
# In[51]:
m=a.var()
print(m)
# In[52]:
n=a['ActiveCases'].var()
print(n)
# Quantile
# In[53]:
o=a.quantile(q=[0.25,0.50,0.75,1.00])
print(o)
# Pivoting
# In[54]:
p=a.loc['USA'].pipe(np.add,100000).pipe(np.multiply,50)
print(p)
# In[55]:
q=a.iloc[0].pipe(np.add,100000).pipe(np.multiply,50)
print(q)
# Apply & Applymap Function
# In[57]:
r=a['SQRT']=a['TotalCases'].apply(np.sqrt)
print(r)
# In[29]:
print(a)
# In[58]:
s=a.applymap(np.sqrt)
print(s)
# MIN/MAX
# In[31]:
t=a.max()
print(t)
# In[59]:
u=a.min()
print(u)
# Head & Tail
# In[60]:
v=a.head(2)
print(v)
# In[61]:
w=a.tail(2)
print(w)
# Pyplot
# Graphs
# Line Graph
# In[35]:
CC=('USA', 'India','Brazil','Russia','France')
TC=(14774167, 9608418, 6534951,2431731,2268552)
TR=(8663603,9058822,5744369,1916396,1688352)
TD=(285656,139736,175951,42384,54767)
AC=(5824908,409860,614614,472654,2045433)
# In[62]:
pl.figure(figsize=[12,8])
pl.grid()
pl.plot(CC, TC, 'c', linewidth=1, marker='.', markersize=3, markeredgecolor='c')
pl.plot(CC, TR, 'g', linewidth=1, marker='*', markersize=2.5, markeredgecolor='g')
pl.plot(CC, TD, 'r', linewidth=1, marker='d', markersize=2, markeredgecolor='r')
pl.plot(CC, AC, 'k', linewidth=1, marker='+', markersize=2, markeredgecolor='k')
pl.xlabel('Countries')
pl.ylabel('Population')
pl.title('CoronaVirus')
pl.plot(CC, TC, color='c', label ='Total Cases')
pl.plot(CC, TR, color='g', label ='Total Recovered')
pl.plot(CC, TD, color='r', label ='Total Deaths')
pl.plot(CC, AC, color='k', label ='Active Cases')
pl.legend(loc=1)
pl.show()
# Bar Graph
# In[63]:
pl.figure(figsize=(10,7))
pl.grid()
pl.bar(CC,TC, color='c', width=0.25, label='TotalCases')
pl.bar(CC,TR, color='g', width=0.50, label='TotalRecovered')
pl.bar(CC,AC, color='k', width=0.75, label='ActiveCases')
pl.bar(CC,TD, color='r', width=1.0, label='TotalDeaths')
pl.legend(loc=1)
pl.title('CoronaVirus')
pl.xlabel('Countries')
pl.ylabel('Population')
pl.show()
# Pie
# In[64]:
pl.figure(figsize=[12,7])
pl.axis('equal')
exp=[0,0.05,0,0,0]
pl.pie(TC, labels=CC, autopct='%1.1f%%', explode=exp)
pl.show()
# BoxPlot
pl.figure(figsize=[12,7])
Ls=[TC,TR,TD,AC]
pl.boxplot(Ls, labels=['USA','India','Brazil','France'], patch_artist='True',
showmeans='True')
pl.title('CoronaVirus BoxPlot')
pl.xlabel('Countries')
pl.ylabel('Population')
pl.show()
# Histogram
import numpy as np
mu=100
sigma=15
x=mu+sigma*np.random.randn(10000)
pl.figure(figsize=[12,6])
pl.hist(x,bins=40, color='r', histtype='step')
pl.title('GivenExample')
pl.xlabel('X-Axis')
pl.ylabel('Y-Axis')
pl.show()
Bibliography
o Information Practice for Class XII by Sumit Arora
o https://www.python.org
o https://www.stackoverflow.com
o https://www.w3school.com
o https://codeproject.com
o https://codeacademy.com
o https://www.quru99.com
o https://tutorialpoint.com