0% found this document useful (0 votes)
107 views23 pages

Ip Project

The document discusses Python as a programming language. It notes that Python is often used to build websites, software, automate tasks, and conduct data analysis. It is a general-purpose and versatile language that has made it one of the most popular languages among developers. The document then provides examples of everyday tasks that can be automated using Python, such as tracking stock prices, sending text reminders, updating grocery lists, and more. Finally, the document includes a Python program example that reads COVID-19 case data from a CSV file and allows users to visualize the data through different chart types like line charts, bar graphs, and scatter plots.

Uploaded by

kawsar
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)
107 views23 pages

Ip Project

The document discusses Python as a programming language. It notes that Python is often used to build websites, software, automate tasks, and conduct data analysis. It is a general-purpose and versatile language that has made it one of the most popular languages among developers. The document then provides examples of everyday tasks that can be automated using Python, such as tracking stock prices, sending text reminders, updating grocery lists, and more. Finally, the document includes a Python program example that reads COVID-19 case data from a CSV file and allows users to visualize the data through different chart types like line charts, bar graphs, and scatter plots.

Uploaded by

kawsar
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

Introduction:

Python is an open-source programming language that is used in web


programing, data science, AI (Artificial Intelligence, and many scientific
applications. Learning python allow the programmer to focus on solving
problems rather than focusing on syntax. Its relative size and simplified give it
an edge over languages like java and c ++, yet the abundance of libraries gives
it the power needed to accomplish great things.
AIM
Python is a computer programming language often used to build websites and
software, automate tasks, and conduct data analysis. Python is a general-
purpose language, meaning it can be used to create a variety of different
programs and isn’t specialized for any specific problems. This versatility, along
with its beginner-friendliness, has made it one of the most-used programming
languages today. A survey conducted by industry analyst firm RedMonk found
that it was the second-most popular programming language among developers
in 2021.

Everyday tasks
Python isn't only for programmers and data scientists. Learning Python can
open new possibilities for those in less data-heavy professions, like journalists,
small business owners, or social media marketers. Python can also enable non-
programmers to simplify certain tasks in their lives. Here are just a few of the
tasks you could automate with Python:

 Keep track of stock market or crypto prices


 Send yourself a text reminder to carry an umbrella anytime it’s raining
 Update your grocery shopping list
 Renaming large batches of files
 Converting text files to spreadsheets
 Randomly assign chores to family members
 Fill out online forms automatically
Program
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

def Fun():
print(":)")
print("#1. For checking the data.")
print("#2. Reading complete file without index.")
print("===================")
print("Topic - Data Visualization")
print(" ")
print("#3. Line Chart")
print(" Press 1 to print the data for Confirmed cases as per Districts.")
print(" Press 2 to print the data for Recovered cases as per Districts.")
print(" Press 3 to print the data for Death cases as per Districts.")
print(" Press 4 to print the data for Active cases as per Districts.")
print(" Press 5 to print All data.")
print(" ")
print("#4. Bar Graph")
print(" Press 1 to print the data for Confirmed cases as per Districts.")
print(" Press 2 to print the data for Recovered cases as per Districts.")
print(" Press 3 to print the data for Death cases as per Districts.")
print(" Press 4 to print the data for Active cases as per Districts.")
print(" Press 5 to print the data in form of stack bar chart")
print(" Press 6 to print the data in form of multi bar chart")
print(" ")
print("#5. Scatter Chart")
print(" ")
print("#6. For Exit")
print("===============")

def Read_csv():
print("The Data")
df=pd.read_csv('Flu_data_Hyderabad.csv')
print(df)

def No_Index():
print("Reading the file without index")
df=pd.read_csv('Flu_data_Hyderabad.csv', index_col=0)
print(df)

#FOR LINE CHART:)

def line_plot():
df=pd.read_csv('Flu_data_Hyderabad.csv')
df['Districts'] =
['EKM','PTA','KTM','TSR','KKD','MPM','KLM','PKD','ALP','KNR','TVM
','IDK','WYD','KGD']
District=df["Districts"]
Confirmed=df["Confirmed"]
Recovered=df["Recovered"]
Deaths=df["Deaths"]
Active=df["Active"]
plt.xlabel("Districts")

YC = int(input("Enter the number representing your preferred line chart


from the above choices: "))

if YC == 1:
plt.ylabel("Confirmed Cases")
plt.title("Districts Confirmed Cases")
plt.plot(District, Confirmed, color='c')
plt.show()
elif YC == 2:
plt.ylabel("Recovered Cases")
plt.title("Districts Recovered Cases")
plt.plot(District, Recovered, color='r')
plt.show()
elif YC == 3:
plt.ylabel("Death Cases")
plt.title("Districts Death Cases")
plt.plot(District, Deaths, color='g')
plt.show()
elif YC == 4:
plt.ylabel("Active Cases")
plt.title("Districts Active Cases")
plt.plot(District, Active, color='b')
plt.show()
elif YC == 5:
plt.ylabel("Number of cases")
plt.plot(District, Confirmed, color='c', label = "Districts Confirmed
Cases")
plt.plot(District, Recovered, color='r', label = "Districts Recovered
Cases")
plt.plot(District, Deaths, color='g', label = "Districts Death Cases")
plt.plot(District, Active, color='b', label = "Districts Active Cases")
plt.legend()
plt.show()
else:
print("Enter valid input")

#FOR BAR GRAPH:)

def bar_plot():
df = pd.read_csv('Flu_data_Hyderabad.csv')
df['Districts'] =
['EKM','PTA','KTM','TSR','KKD','MPM','KLM','PKD','ALP','KNR','TVM
','IDK','WYD','KGD']
District = df["Districts"]
Confirmed = df["Confirmed"]
Recovered = df["Recovered"]
Deaths = df["Deaths"]
Active = df["Active"]
plt.xlabel("Districts")

YC = int(input("Enter the number representing your preferred bar graph


from the above choices:"))

if YC == 1:
plt.ylabel("Confirmed Cases")
plt.title("Districts Confirmed Cases")
plt.bar(District, Confirmed, color='c', width = 0.10)
plt.show()
elif YC == 2:
plt.ylabel("Recovered Cases")
plt.title("Districts Recovered Cases")
plt.bar(District, Recovered, color='r', width = 0.10)
plt.show()
elif YC == 3:
plt.ylabel("Death Cases")
plt.title("Districts Death Cases")
plt.bar(District, Deaths, color='g', width = 0.10)
plt.show()
elif YC == 4:
plt.ylabel("Active Cases")
plt.title("Districts Active Cases")
plt.bar(District, Active, color='b', width = 0.10)
plt.show()
elif YC == 5:
plt.bar(District, Confirmed, color='c', width = 0.10, label = "Districts
Confirmed Cases")
plt.bar(District, Recovered, color='r', width = 0.10, label = "Districts
Recovered Cases")
plt.bar(District, Deaths, color='g', width = 0.10, label = "Districts Death
Cases")
plt.bar(District, Active, color='b',width = 0.10, label = "Districts Active
Cases")
plt.legend()
plt.show()
elif YC == 6:
D=np.arange(len(District))
width=0.25
plt.bar(D,Confirmed, width, color='c', label = "Districts Confirmed
Cases")
plt.bar(D+0.25, Recovered, width, color='r', label = "Districts Recovered
Cases")
plt.bar(D+0.50, Deaths, width, color='g', label = "Districts Death Cases")
plt.bar(D+0.75, Active ,width, color='b', label = "Districts Active Cases")
plt.legend()
plt.show()
else:
print("Enter valid input")

def scatter_chart():
df=pd.read_csv('Flu_data_Hyderabad.csv')
df['Districts'] =
['EKM','PTA','KTM','TSR','KKD','MPM','KLM','PKD','ALP','KNR','TVM
','IDK','WYD','KGD']
District = df["Districts"]
Confirmed = df["Confirmed"]
Recovered = df["Recovered"]
Deaths = df["Deaths"]
Active = df["Active"]

SC=plt.gca()
SC=plt.scatter(District, Confirmed, color="c", label="Districts Confirmed
Cases")
SC=plt.scatter(District, Recovered, color="r", label="Districts Recovered
Cases")
SC=plt.scatter(District, Deaths, color="g", label="Districts Death Cases")
SC=plt.scatter(District, Active, color="b", label="Districts Active Cases")

plt.xlabel("District")
plt.title("Complete Scatter Chart")
plt.legend()
plt.show()

Fun()
YC = int(input("Enter Your Choice: "))

while YC == 1 or 2 or 3 or 4 or 5 or 6:

if YC == 1:
Read_csv()
break
elif YC == 2:
No_Index()
break
elif YC == 3:
line_plot()
break
elif YC == 4:
bar_plot()
break
elif YC == 5:
scatter_chart()
break
elif YC == 6:
print("Thank You for using...")
break
else:
print("Enter valid input")
break
Output

You might also like