0% found this document useful (0 votes)
13 views

Name

This document contains a project report on analyzing COVID-19 data. It includes an introduction to Python, Pandas, and data visualization with Matplotlib. It then provides the source code for reading COVID-19 case data from a CSV file and performing operations like sorting, adding, editing, and deleting records. Functions are defined to generate line charts visualizing cases by district.

Uploaded by

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

Name

This document contains a project report on analyzing COVID-19 data. It includes an introduction to Python, Pandas, and data visualization with Matplotlib. It then provides the source code for reading COVID-19 case data from a CSV file and performing operations like sorting, adding, editing, and deleting records. Functions are defined to generate line charts visualizing cases by district.

Uploaded by

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

INFORMATICS PRACTICES

CLASS XII
2023 - 24

NAME :-

TOPIC :- COVID 19 ANALYSIS

P a g e 1 | 23
ROLL NO. :-

N . R CONVENT SR SEC SCHOOL, NEW


DELHI

CERTIFICATE

This is to certify that of


class XII, of N.R CONVENT SR SEC SCHOOL, New Delhi
has completed this project report under the guidance of
Mr. SACHIN JAISWAL during the academic year 2023-24.

Signature of the Teacher:

Signature of Head of the School: ________________________

P a g e 2 | 23
School Seal:

ACKNOWLEDGEMENT

I would like to express my special thanks of gratitude To


my teacher Mr Sachin Jaiswal who gave me the golden
opportunity to do this wonderful project on the topic
COVID 19 ANALYSIS which also helped me in doing
a lot of research and I came to know about so many new
things.

Secondly I would also like to thank my parents and


friends who helped me a lot in finishing this project
within the time limit.

I am making this project not only for marks but to also


increase my knowledge.
.

Signature of the Student:

P a g e 3 | 23
INDEX
 INTRODUCTION

 REQUIREMENT

 CSV DATA FILE

 SOURCE CODE

 OUTPUT SCREEN

 BIBLIOGRAPHY

P a g e 4 | 23
OVERVIEW OF PYTHON
Python is a general purpose, dynamic, high-level, and interpreted programming
language. It supports Object Oriented programming approach to develop applications.
It is the simple and easy to learn and provides lots of high level data structures. Guido
Van Rossum is known as the founder of Python programming.

Features of Python:

Python is a high level language. It is a free and open source language.

It is an interpreted language, as python programs are executed by an

interpreter.

Python is programs are easy to understand as they have a clearly defined

syntax and relatively simple structure.

Python case-sensitive. For example, NUMBER and number are not same in

Python.

Python is portable and platform independent, means it can run on various

operating systems and hardware platforms.

Python has a rich library of predefined functions.

P a g e 5 | 23
Python is also helpful in web development. Many popular web services and

applications are built using python.

Python uses indentation for blocks and nested blocks.

OVERVIEW OF PANDAS
PANDAS:
Pandas is a software library written for the Python programming language for data
manipulation and analysis. In particular, it offers data structures and operations for
manipulating numerical tables and time series.
Pandas is a Python library used for working with data sets.
• It has functions for analyzing, cleaning, exploring, and manipulating data.
• The name "Pandas" has a reference to both "Panel Data", and "Python Data
Analysis" and was created by Wes McKinney in 2008.
• Pandas allows us to analyze big data and make conclusions based on statistical
theories.
• Pandas can clean messy data sets, and make them readable and relevant.
• Relevant data is very important in data science.
• Pandas are also able to delete rows that are not relevant, or contains wrong
values, like empty or NULL values. This is called cleaning the data.

Installing Pandas
To Install pandas type this command in cmd prompt

pip install pandas


To import this library:

P a g e 6 | 23
import pandas as pd

OVERVIEW OF DATA VISUALZATION


Data Visualization
Data Visualization is the techinque to present the data in a pictorial or graphical
format. It enables stakeholders and decision makers to analyze data visually. The data
in a graphical format allows them to identify new patterns easily.

When the numerical data is plotted on a graph or converted into charts it is easy to
identify the patterns and predict the result accurately.

The three major considerations for Data Visualization are:

Clarity
Accuracy
Efficiency
Matplotlib
Matplotlib is a python two-dimensional plotting library for data visaulization and
creating interactive graphics or plots. Using python’s matplotlib, the data
visualization of large and complex data becomes easy.

Matplotlib Advantages
There are several advantages of using matplotlib to visualize data.

A multi-platform data visualization tool built on the numpy and sidepy


framework. Therefore, it’s fast and efficient.
It possesses the ability to work well with many operating systems and graphic
back ends.
It has full control over graph or plot styles such as line properties, thoughts, and
access properties.
It possesses high-quality graphics and plots to print and view for a range of
graphs such as histograms, bar charts, pie charts, scatter plots and heat maps.

P a g e 7 | 23
It has large community support and cross platform support as it is an open
source tool.

MATPLOTLIB

To import this library:

import matplotlib.pyplot as plt

INTRODUCTION TO covid-19 pandemic analysis system


Coronavirus disease (COVID-19) is an infectious disease caused by a newly discovered
coronavirus.

Most people infected with the COVID-19 virus will experience mild to moderate respiratory illness
and recover without requiring special treatment. Older people, and those with underlying medical
problems like cardiovascular disease, diabetes, chronic respiratory disease, and cancer are more
likely to develop serious illness.

The best way to prevent and slow down transmission is be well informed about the COVID-19
virus, the disease it causes and how it spreads. Protect yourself and others from infection by
washing your hands or using an alcohol based rub frequently and not touching your face.

The COVID-19 virus spreads primarily through droplets of saliva or discharge from the nose when
an infected person coughs or sneezes, so it’s important that you also practice respiratory etiquette
(for example, by coughing into a flexed elbow).

At this time, there are no specific vaccines or treatments for COVID-19. However, there are many
ongoing clinical trials evaluating potential treatments. WHO will continue to provide updated
information as soon as clinical findings become available.

P a g e 8 | 23
SOURCE CODE
import numpy as np import pandas as pd

import matplotlib.pyplot as plt

def showData():

df=pd.read_csv("covid_19.csv") print(df)

input("Press any key to continue....")

def dataNoIndex():

df=pd.read_csv("covid_19.csv",index_col=0) print(df)

input("Press any key to continue...")

def data_sorted():

df=pd.read_csv('covid_19.csv') print(df.sort_values(by=['Confirmed']))

def write_data():

print("Insert data of particular districts in list form:") di=eval(input("Enter Districts:"))

con_cases=eval(input("Enter no. of confirmed cases:")) rec=eval(input("Enter no. of recovered


cases:")) deaths=eval(input("Enter deaths:")) active=eval(input("Enter active cases:"))

d={'Districts':di,'Confirmed':con_cases,'Recovered':rec,'Deaths':d eaths,'Active':active}
df=pd.DataFrame(d)

df.to_csv('covid_19.csv', mode='a', index=False, header=False) print("Data has been added.")


input("Press any key to continue...")

def edit_data():

df=pd.read_csv("covid_19.csv") di=input("Enter district to edit:")


col=input("Enter column name to update:") val=input("Enter new value")

df.loc[df[df['Districts']==di].index.values,col]=val
df.to_csv("covid_19.csv",index=False) print("Record has been updated...")
input("Press any key to continue...")

P a g e 9 | 23
def delete_data():

di=input("Enter district to delete data:") df=pd.read_csv("covid_19.csv")


df=df[df.Districts!=di]

df.to_csv('covid_19.csv',index=False) print("Record deleted...")

def line_chart():

df=pd.read_csv('covid_19.csv')

District=df["Districts"]

Confirmed=df["Confirmed"]

Recovered=df["Recovered"]

Deaths=df["Deaths"] Active=df["Active"] plt.xlabel("Districts") Y=0 while Y!=6:

print(" ==============================") print(" Line Graph Menu")


print(" ==============================") print("1.District wise Confirmed Cases ")
print("2.District wise Recovered Cases ") print("3.District wise Death Cases") print("4.District wise
Active Cases") print("5.All data")

print("6.Return to main menu.")

Y = int(input("Enter your choice to get line graph: ")) if Y == 1:

plt.ylabel("Confirmed Cases")

plt.title("Districts Wise Confirmed Cases") plt.plot(District, Confirmed,


color='b') plt.show() elif Y == 2:

plt.ylabel("Recovered Cases")

plt.title("Districts Wise Recovered Cases") plt.plot(District, Recovered,


color='g') plt.show() elif Y == 3:

plt.ylabel("Death Cases")

plt.title("Districts Wise Death Cases") plt.plot(District, Deaths,


color='r') plt.show() elif Y == 4:

plt.ylabel("Active Cases")

P a g e 10 | 23
plt.title("Districts Wise Active Cases") plt.plot(District, Active, color='c') plt.show()
elif Y == 5:

plt.ylabel("Number of cases")

plt.plot(District, Confirmed, color='b', label =

"Districts Wise Confirmed Cases")

plt.plot(District, Recovered, color='g', label =

"Districts Wise Recovered Cases")

plt.plot(District, Deaths, color='r', label = "Districts Wise Death Cases")

plt.plot(District, Active, color='c', label = "Districts Wise Active Cases") plt.legend()


plt.show() elif Y==6:

print("Line Graph Closed.....") main_menu() else:

print("Sorry!! Invalid Option! Try Again!!!") main_menu() def bar_chart():

df=pd.read_csv('covid_19.csv')

District=df["Districts"]

Confirmed=df["Confirmed"]

Recovered=df["Recovered"]

Deaths=df["Deaths"] Active=df["Active"] plt.xlabel("Districts")

print(" ==============================") print(" Bar Graph


Menu") print(" ==============================") print("1. District Wise
Confirmed Cases") print("2. District Wise Recovered Cases") print("3. District Wise Death Cases")
print("4. District Wise Active Cases") print("5. All data") print("6. Combine Bar Graph") print("7.
Return to main menu.") Y=0 while Y!=5:
Y = int(input("Enter your choice to get bar graph: ")) if Y == 1:

plt.ylabel("Confirmed Cases")

plt.title("Districts Wise Confirmed Cases") plt.bar(District, Confirmed, color='b', width =


0.5) plt.show() elif Y == 2:

plt.ylabel("Recovered Cases")

plt.title("Districts Wise Recovered Cases") plt.bar(District, Recovered, color='g', width =


0.5) plt.show() elif Y == 3:

P a g e 11 | 23
plt.ylabel("Death Cases")

plt.title("Districts Wise Death Cases") plt.bar(District, Deaths, color='r', width = 0.5)


plt.show() elif Y == 4:

plt.ylabel("Active Cases")

plt.title("Districts Wise Active Cases") plt.bar(District, Active, color='c', width = 0.5)


plt.show() elif Y == 5:

plt.bar(District, Confirmed, color='b', width = 0.5, label = "Districts Wise Confirmed Cases")

plt.bar(District, Recovered, color='g', width = 0.5, label = "Districts Wise Recovered Cases")

plt.bar(District, Deaths, color='r', width = 0.5, label

= "Districts Wise Death Cases")

plt.bar(District, Active, color='c',width = 0.5, label =

"Districts Wise Active Cases") plt.legend()


plt.show() elif Y == 6:

D=np.arange(len(District)) width=0.25

plt.bar(D,Confirmed, width, color='b', label =

"Districts Wise Confirmed Cases")

plt.bar(D+0.25, Recovered, width, color='g', label =

"Districts Wise Recovered Cases")

plt.bar(D+0.50, Deaths, width, color='r', label =

"Districts Wise Death Cases")

plt.bar(D+0.75, Active ,width, color='c', label =

"Districts Wise Active Cases") plt.legend()


plt.show() elif Y==7: print("Bar Graph Closed.....")
main_menu() else:

print("Sorry!! Invalid Option! Try Again!!!") main_menu()

def main_menu(): ch=0

P a g e 12 | 23
print(" ==============================") print(" Main Menu")
print(" ==============================") while ch!=9: print("""

1. Show DataFrame
2. Data without index
3. Data in Ascending order of Confirmed cases
4. Add district data into CSV
5. Edit a record
6. Delete a record
7. Line Graph
8. Bar Graph
9. Exit """)
ch=int(input("Enter your choice:")) if ch==1:
showData() elif ch==2: dataNoIndex() elif ch==4:
write_data() elif ch==3: data_sorted() elif ch==5:
edit_data() elif ch==6: delete_data() elif ch==7:
line_chart() elif ch==8: bar_chart() elif ch==9:

print("Thank you for using our App, Bye Bye, See you again!!") break main_menu()

P a g e 13 | 23
OUTPUT
1. Main Menu

2. DataFrame

3. Data without Index

P a g e 14 | 23
4. Data in Ascending order of confirmed cases

5. Add district data into CSV

P a g e 15 | 23
6. Edit a record

7. Delete a record

8. Line Graph

P a g e 16 | 23
9. Line Graph of District wise confirmed cases

10. District wise recovered cases

P a g e 17 | 23
11. District wise death cases

12. Active Cases line graph

P a g e 18 | 23
13. All Cases

14. Confirmed Cases bar

P a g e 19 | 23
15. Recovered Cases bar

16. Death Cases Bar

P a g e 20 | 23
17. Active Cases Bar Graph

18. All Data bar

P a g e 21 | 23
19. Combine bar graph

20. Exit

P a g e 22 | 23
BIBLIOGRAPHY
1. Textbooks: NCERT Text Book Informatics Practices Class XII, Informatics Practices a text

book for Class XII – Sumita Arora

2. Youtube

3. www.tutorialaicsip.com

4. www.youtube.com

5. www.datacamp.com

6. www.javapoint.com

P a g e 23 | 23

You might also like