Ip Project
Ip Project
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:
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)
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")
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")
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")
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