CSV PROJECT
PATIENT MAMAGEMENT
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 13 20:37:02 2021
@author: Kirti Hora
"""
import pandas as pd
import matplotlib.pyplot as plt
def main():
while True:
print("="*60)
print("enter 1 to ADD PATIENT DETAILS")
print("enter 2 to DELETE PATIENT DETAIL")
print("enter 3 to UPDATE PATIENT DETAIL")
print("enter 4 to SEARCH PATIENT ")
print("enter 5 to DISPLAY PATIENT DETAILS")
print("enter 6 to DISPLAY CITY WISE GRAPH")
print("enter 7 to EXIT....")
d=int(input("enter choice:"))
print("="*60)
if d==1:
add()
elif d==2:
delete()
elif d==3:
update()
elif d==4:
search()
elif d==5:
display()
elif d==6:
gra()
elif d==7:
print("*********THANKS FOR USING HOSPITAL/PATIENT MANAGEMENT SYSTEM**********")
break
else:
print("Enter correct choice. . .")
def add():
print("---------------------------------------------------------------------------")
print("---------------------------------------------------------------------------")
df=pd.read_csv("D:\GRADE XII PYTHON/patients.csv",index_col=0)
pid=int(input("Enter pid"))
if len(df.loc[df['pid']==pid])>0:
print("Duplicate Record")
else:
name=input("Enter NAME")
cla=int(input("Enter AGE"))
sec=input("Enter GENDER")
addr=input("Enter ADDRESS")
dise=input("Enter DISEASE")
df.loc[pid]=[pid,name,cla,sec,addr,dise]
df.to_csv("D:\GRADE XII PYTHON/patients.csv",mode="w")
print("RECORD ADDED SUCCESSFULLY")
print("="*60)
def update():
print("---------------------------------------------------------------------------")
print("---------------------------------------------------------------------------")
df=pd.read_csv("D:\GRADE XII PYTHON/patients.csv",index_col=0)
pid=int(input("Enter PATIENT ID:"))
if len(df.loc[df['pid']==pid])>0:
name=input("Enter name")
age=input("Enter AGE")
gen=input("Enter GENDER")
addr=input("Enter ADDRESS")
dise=input("Enter DISEASE")
df.loc[pid]=[pid,name,age,gen,addr,dise]
df.to_csv("D:\GRADE XII PYTHON/patients.csv",mode="w")
print("RECORD ADDED SUCCESSFULLY")
print("="*60)
else:
print("Invalid Patient Id")
def display():
df=pd.read_csv("D:\GRADE XII PYTHON/patients.csv",index_col=0)
print(df)
print("="*60)
def delete():
print("---------------------------------------------------------------------------")
print("---------------------------------------------------------------------------")
df=pd.read_csv("D:\GRADE XII PYTHON/patients.csv",index_col=0)
sid=int(input("Enter Pid"))
if len(df.loc[df['pid']==sid])>0:
df.drop(sid,inplace=True)
df.to_csv("D:\GRADE XII PYTHON/test.csv",mode="w")
print("Record Deleted")
print("="*60)
def search():
print("---------------------------------------------------------------------------")
print("---------------------------------------------------------------------------")
df=pd.read_csv("D:\GRADE XII PYTHON/patients.csv",index_col=0)
pid=int(input("Enter Pid"))
if len(df.loc[df['pid']==pid])>0:
print(df.loc[pid])
print("="*60)
else:
print("Record not Found")
print("="*60)
def gra():
df=pd.read_csv("D:\GRADE XII PYTHON/patients.csv",index_col=0)
plt.plot(df['address'],label="CITY WISE GRAPH")
plt.title("CITY WISE GRAPH")
plt.xlabel("CITY")
plt.show()
main()
___________________________________________________________________
PROJECT -II
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 6 22:07:51 2024
@author: Kirti Hora
"""
import pandas as pd
def main():
while True:
print("="*60)
print("WELCOME TO CBSE MARK ANALYSIS PROGRAM")
print("="*60)
print("Enter 1 to DISPLAY RECORDS")
print("Enter 2 to DISPLAY MAX MARKS ACCORDING TO SUB CODE")
print("Enter 3 to DISPLAY A1 GRADE ACCORDING TO SUB CODE")
print("Enter 4 to SEARCH STUDENT")
print("Enter 5 to EXIT")
d = int(input("Enter choice: "))
print("="*60)
if d == 1:
upload()
elif d == 2:
max_marks()
elif d == 3:
grade()
elif d == 4:
search()
elif d == 5:
print("********* THANKS FOR USING CBSE MARK ANALYSIS SYSTEM **********")
break
else:
print("Enter correct choice...")
def upload():
print("-"*60)
df = pd.read_csv(r"C:\Users\Kirti Hora\Downloads\try2.csv", index_col=0)
print(df)
def max_marks():
print("-"*60)
df = pd.read_csv(r"C:\Users\Kirti Hora\Downloads\try2.csv", index_col=0)
code = int(input("Enter Subject Code: "))
sub = df.loc[df['CD'] == code]
if len(sub) > 0:
highest = sub['MARKS'].iloc[0]
for i in sub['MARKS']:
if i > highest:
highest = i
print("Maximum Marks in Subject Code", code, "=", highest)
else:
print("Subject Code not found")
def grade():
print("-"*60)
df = pd.read_csv(r"C:\Users\Kirti Hora\Downloads\try2.csv", index_col=0)
code = int(input("Enter Subject Code: "))
sub = df.loc[(df['CD'] == code) & (df['GRADE'] == 'A1')]
if len(sub) > 0:
print("Students with A1 Grade:")
print(sub)
else:
print("No A1 grade found for this subject")
def search():
print("-"*60)
df = pd.read_csv(r"C:\Users\Kirti Hora\Downloads\try2.csv", index_col=0)
roll = int(input("Enter Roll Number: "))
stu = df.loc[df['ROLLNO'] == roll]
if len(stu) > 0:
print(stu)
print("="*60)
else:
print("Record not Found")
print("="*60)
main()
Comments
Post a Comment