Professional Documents
Culture Documents
a26c8d8a3b4d4be6ac5c9b567d2b2b38
a26c8d8a3b4d4be6ac5c9b567d2b2b38
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("---------------------------------")
print("1. add CSV
to desktop")
print("2. add details")
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(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 : ")
#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("_"*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")
#print(df)
#print("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")
#print("_"*70)
#print()
elif ch==4:
df=pd.read_csv("C:\\Users\\raghav\\Desktop\\project.csv")
while True:
ac=str(input("enter class no. : "))
if choice==1:
value=-1
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:
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("_"*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:
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
#print(df)
#df.to_csv("C:\\Users\\raghav\\Desktop\\project.csv", sep=",")
#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:
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("_"*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")
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...")
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: