You are on page 1of 6

import pandas as pd

import matplotlib.pyplot as plt


import csv
import
os
#df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv",
sep=",",index_col="Class no")
#??
print("------------------------------------------------------------------------------
")
print(" orignal table
")
#print(df)
while True:
print("-"*55)
print("
"*50,"Welcome to Mahaveer Public School")
print("-"*55)

print("1. Login")
print("2. Exit")
lc=int(input("Enter Your
Choice"))
if lc==1:
unm = input("Enter User Name")
pwd =
input("Enter Password")
if unm=='prithvi' and pwd=='harsh':

print("Login Success")
print("Welcome ", unm)

while True:
print("---------------------------------")

print("welcome to mahaveer public school")

print("---------------------------------")
print("1. add CSV
to desktop")
print("2. add details")

print("3. delete class")


print("4. update class")

print("5. view class")


print("6. search
class")
print("7. class graph")

print("8. CSV deleted")


print("9. exit")

print()
ch=int(input("Enter Your Choice"))
if
ch==1:
col=["class_no", "class_name",
"class_time", "no_of_students"]

df=pd.DataFrame(columns=col)

df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv",index=False)

print("CSV created")
if ch==2:

print("reading CSV")

df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")

lst=df.columns.tolist()
while True:
dict1={}
lst1=[]
for a in lst:

dict1[a]=input("Enter "+a)

df=df.append(dict1,ignore_index=True)
lst1.append(dict1)

print("*** Record collected ***")


print("Is
there is any thing you missed out??")
print("#"*60)

print("if yes print Y else N")

b=input("Enter your choice:")


if b=="y" or
b=="Y":
print("-"*60)

print(df)
else:

df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv",index=False)

break

#df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv",
sep=",",index_col="Class no")
#class_no=input("
enter class no. : ")
#class_name=input(" emter class name :
")
#class_time=input("enter class time : ")

#no_of_students=input("enter no. of students : ")

#df2={class_no, class_name, class_time, no_of_students}

#df2=pd.DataFrame(df2)
#df.at[class_no]=[class_name, class_time,
no_of_students]
print(df)

#df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")

print("CSV File UPDATED Successfully...")

print("_"*70)
print()
elif ch==3:

df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")

while True:
c=input("Enter the classno.")

sind=-1
se=df["class_no"]
for
s in range(len(se)):
if se[s]==str(c):

sind=s
break
if sind==-1:

print(c,"not found")
else:

df=df.drop(sind)
print("-"*60)
print(df)

df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv",index=False)

print("record deleted...")
dch=input("Is there
is any thing you missed out?? if yes=Y,y or NO=n,N. :- ")
if
dch=='Y' or dch=='y':
continue
else:

break

#df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv",
sep=",",index_col="Class no")

#drprow=int(input("enter class no. : "))


#df=df.drop(drprow)

#print(df)

#print("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")

#print("csv file updated successfully")

#print("_"*70)
#print()
elif ch==4:

df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")

while True:
ac=str(input("enter class no. : "))

print("1. class name")


print("2.
class time")
print("3. no. of students")

choice=int(input("enter the choice to be updated : "))

if choice==1:
value=-1

#ac=input("enter updated class name : ")

A1=df["class_no"]
#A=df.class_name[st]=ac

for s in range(len(A1)):
if A1[s]==str(ac):

value=s
break

if value==-1:
print(ac,"not
found")
else:

a=input("enter the class name")

df.loc[value,"class_name"]=a

df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv",index=False)

print("updated")
print(df)

dch=input("is there is any other Record you want to search for yes=Y,y or
NO=n,N. :- ")
if dch=='Y' or dch=='y':

continue
else:
break

#print(df)

#df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")

#print("csv file updated successfully")

#print("_"*70)
#print()
elif
choice==2:
value=-1

A1=df["class_no"]
for s in range(len(A1)):

if A1[s]==str(ac):
value=s

break
if value==-1:

print(ac,"not found")
else:

a=input("enter the class time")

df.loc[value,"class_time"]=a

df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv",index=False)

print("updated")
print(df)

dch=input("is there is any other Record you want to search for yes=Y,y or
NO=n,N. :- ")
if dch=='Y' or dch=='y':

continue
else:
break

#ac=int(input("enter updated class


time : "))
#df.class_time[st]=ac

#print(df)

#df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")

#print("csv file updated successfully")

#print("_"*70)
#print()
elif
choice==3:
value=-1

A1=df["class_no"]
for s in range(len(A1)):

if A1[s]==str(ac):
value=s

break
if value==-1:

print(ac,"not found")
else:

a=input("enter the no_of_students")


df.loc[value,"no_of_students"]=a

df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv",index=False)

print("updated")
print(df)

dch=input("is there is any other Record you want to search for yes=Y,y or
NO=n,N. :- ")
if dch=='Y' or dch=='y':

continue
else:
break

#ac=int(input("enter updated no. of


students : "))
#df.no_of_students[st]=ac

#print(df)

#df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")

#print("csv file updated successfully")

#print("_"*70)
#print()
elif ch==5:

print("-"*70)

df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")

print("printing Record")
print(df)

print("_"*70)
print()
elif ch==6:

df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")

print("searching class by class no. ")


vie=str(input("enter
class no. : "))
while True:
sind=-1

se=df["class_no"]
for s in range(len(se)):

if se[s]==str(vie):
sind=s

break
if sind==-1:

print(vie,"not found")
else:

print(df.loc[sind])
print("-"*60)

#print(df)
print("record found...")

dch=input("Is there is any thing you missed out?? if yes=Y,y or NO=n,N. :-


")
if dch=='Y' or dch=='y':

continue
else:
break

#print(df.loc[vie])
elif ch==7:
print("-"*60)

df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")

df.plot(x='class_name',y="no_of_students",kind="bar",color="Blue"
)
plt.xlabel("CLASS NAME")

plt.ylabel("NO OF STUDENTS")
plt.title("Hobby Class")

plt.show()
elif ch==8:
print("
")
os.remove("C:\\Users\\raghav\\Desktop\\project.csv")

print("Deleted...")
continue

elif ch==9:
print("_"*70)

print()
print("thank you")

print("_"*70)
break
else:

print("incorrect username or password......")


continue
elif
lc==2:
break
print("THANK YOU : ")

Powered by TCPDF (www.tcpdf.org)

You might also like