Covid_Data_Visualization_Code
Covid_Data_Visualization_Code
import pandas as pd
import numpy as np
def Fun():
print(":)")
print("===================")
print(" ")
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(" ")
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(" ")
print(" ")
print("===============")
def Read_CSV(df):
print("The Data")
print(df)
def No_Index():
df = pd.read_csv('Covid_data_kerala.csv', index_col=0)
print(df)
def line_plot(df):
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.show()
elif YC == 2:
plt.ylabel("Recovered Cases")
plt.show()
elif YC == 3:
plt.ylabel("Death Cases")
plt.show()
elif YC == 4:
plt.ylabel("Active Cases")
plt.show()
elif YC == 5:
plt.ylabel("Number of cases")
plt.legend()
plt.show()
else:
def main_menu():
try:
df = pd.read_csv('Covid_data_kerala.csv')
except FileNotFoundError:
return
Fun()
while True:
try:
except ValueError:
continue
if YC == 1:
Read_CSV(df)
elif YC == 2:
No_Index()
elif YC == 3:
line_plot(df)
elif YC == 4:
bar_plot(df)
elif YC == 5:
scatter_chart(df)
elif YC == 6:
break
else:
main_menu()