Skip to main content

COVID ANALYSIS | GRADE XII PROJECT (IP)

 

COVID ANALYSIS

GRADE XII PROJECT


import pandas as pd

import matplotlib.pyplot as plt

#import numpy as np


def showdata() :

  df=pd.read_csv(r"D:\GRADE XII PYTHON\covid_19.csv")

  print(df)

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


def dataNoIndex():

  df=pd.read_csv(r"D:\GRADE XII PYTHON\covid_19.csv",index_col=0)

  print(df)

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


def data_sorted():

  df=pd.read_csv(r"D:\GRADE XII PYTHON\covid_19.csv")

  print(df.sort_values(by=['Confirmed']))


def write_data():

  print("Insert data of particular districts in list form:")

  di=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':[deaths],'Active':[active]}

  df=pd.DataFrame(d)

  df.to_csv(r"C:\\Users\\Kirti Hora\\Desktop\\twitter\\covid1_19.csv", mode='a', index=False, header=False)

  #print(df)

  print("Data has been added.")

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

  


def edit_data():

  df=pd.read_csv(r"C:\Users\Kirti Hora\Desktop\twitter/covid1_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(r"C:\Users\Kirti Hora\Desktop\twitter/covid1_19.csv",index=False)

  print("Record has been updated...")

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


def delete_data():

  di=input("Enter district to delete data:")

  df=pd.read_csv(r"C:\Users\Kirti Hora\Desktop\twitter\covid1_19.csv")

  df=df[df.Districts!=di]

  df.to_csv(r"C:\Users\Kirti Hora\Desktop\twitter\covid1_19.csv",index=False)

  print("Record deleted...")


def show_graph():

    df=pd.read_csv(r"C:\Users\Kirti Hora\Desktop\twitter\covid1_19.csv")

    plt.barh(df['Districts'],df['Active'],color='r')

    plt.title('Number of Active Cases')

    plt.xlabel('No of Tests')

    plt.show()


def show_line():

    df=pd.read_csv(r"C:\Users\Kirti Hora\Desktop\twitter\covid1_19.csv")

    plt.plot(df['Districts'],df['Deaths'],color='r')

    plt.title('Number of Active Cases')

    plt.xlabel('No of Tests')

    plt.show()

    


def main_menu():

  ch=0

  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. Active Covid Cases Graph

          8. Line 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:

      show_graph()

    elif ch==8:

      show_line()

      #print("Thank you for using our App, Hope to see you again!!")

      break

main_menu() #FUNCTION CALLING


Comments

Popular posts from this blog

PYTHON - MYSQL CONNECTIVITY CODE

  #INSERTION OF DATA import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", passwd="root", database="school" ) print("Successfully Connected") #print(mydb) mycursor=mydb.cursor()   v1=int(input("enter ID:")) v2=input("enter name:") v3=input("enter Gender:") v4=int(input("enter age:")) sql='insert into TEACH values("%d","%s","%s","%s")'%(v1,v2,v3,v4) print(sql) mycursor.execute(sql) mydb.commit() print("record added") #MYSQL Connection code – Deletion on database SOURCE CODE: s=int(input("enter id of TEACHER to be deleted:")) r=(s,) v="delete from TEACH where id=%s" mycursor.execute(v,r) mydb.commit() print("record deleted") MYSQL Connection code – Updation on database SOURCE CODE: import mysql.connector mydb = mysql.connector.c...

GRADE XII CS - VIVA QUESTIONS

  VIVA QUESTIONS GRADE XII CS Dear All Be thorough with your project and practical files, as the viva can be asked from anywhere. Stay calm, don’t get nervous, and be confident in front of the examiner. 1. Tell me about your project. 2. Which concepts you have used for your project? 3. What do you mean by front end and back end? How they are important in developing any such projects? 4  Mention the modules and built-in functions you have used in your project. 5. Which real world problems are solved by your project? 6. Explain the most important feature of your project. 7. Name a few mutable data types of python. Lists, Sets, and Dictionaries 8. Name a few immutable data types of python. Strings, Tuples, Numeric 9. Name ordered and unordered data type of python. Ordered – String, List, Tuples Unordred – Set, Dictionaries 10. What is the significance of a pass statement in python? pass is no operation python statement. This is used where python requires syntax but logic requires...