Chesta-draksha Project File
Chesta-draksha Project File
Chesta-draksha Project File
o Rapid
prototyping o
Web
Applications o
GUI programs o
Game
development
o Database
Applications o
System
administratin
Pandas
• Pandas is a software library written for Python
INTRODUCTION
CSV Files :
Students
Faculty
Result
Fees
Source Code
import numpy as np
import pandas as pd
import
matplotlib.pyplot as
pl
DF=pd.read_csv("student.csv",index
_col="stid") opt=1 while
opt!=-1:
print()
print('='*60)
print(" STUDENT DETAILS ")
print('='*60) print(" 1.
Add new student
detail") print(" 2.
Remove a student
detail") print(" 3.
Change Semester ")
print(" 4. Display
student detail") print("
5. Search by stid")
print(" 6. Search by
semester") print(" 7.
Sort the data by year -
Ascending") print(" 8.
Sort the data by year -
Descending") print(" 9.
Semesterwise count of
students") print("10. Pie
chart - Students in each
semester") print("-1.
Exit") print()
opt=int(input("enter
your choice")) if
opt==1:
p=int(input("enter
stid")) n=input("enter
student name")
y=int(input("enter year"))
s=input("enter semester")
d=input("enter dob")
f=input("enter Father's Name ")
m=input("enter Mother's Name
") a=input("enter
Address ")
DF.loc[p]=[n,y,s,d,f,m
,a]
DF.to_csv("student.cs
v") print(DF)
print("new student
detail added") elif
opt==2:
s=int(input("enter stid"))
DF.drop(s,inplace=True
)
DF.to_csv("student.csv"
) print(DF)
print("Student detail
removed") elif opt==3:
s=int(input("enter stid"))
print("Current semester
is",DF.loc[s,"semester"])
DF.loc[s,"Semester"]=input("Enter
new semester")
DF.to_csv("student.csv")
print("student semester changed")
elif opt==4: print(DF) elif opt==5:
s=int(input("enter
srno")) print(DF.loc[s]) elif
opt==6:
h=int(input("enter a
semester"))
print(DF[[‘sname’ , ‘year’, ‘semester’, ‘dob’]]
[DF.semester==h]) elif opt==7:
print(DF.sort_values('
year')) elif opt==8:
print(DF.sort_values('year',
ascending=False)) elif opt==9:
DF1=DF.groupby('semeste
r')
print(DF1.semester.count()
) elif opt==-1:
break
else:
print("choose the correct
option") elifch==2:
DF=pd.read_csv("faculty.csv",index_col='
Fcode') opt=1
while opt!=-1:
print()
print('='*60)
1. exit") print()
opt=int(input("enter
your choice")) if
opt==1:
e=int(input("Enter fcode
")) en=input("Enter
DF.loc[e]=[en,a,exp,sub
,sal]
DF.to_csv("faculty.csv"
) print(DF)
print("New faculty detail
e=int(input("enter ecode"))
DF.drop(e,inplace=True
DF.to_csv("faculty.csv"
) print(DF)
e=int(input("enter ecode"))
DF.loc[e,"experience"])
DF.to_csv("faculty.csv")
print(DF[['facultyname','experience','sub
e=int(input("enter
is",DF.loc[e,"salary"])
DF.loc[e,"salary"]=int(input("enter new salary"))
DF.to_csv("faculty.csv")
print(DF[['facultyname','experience','
print(DF)
elif opt==6:
print(DF[['facultyname','experience','subject','salary']].sort
print(DF[['facultyname','experience','subject','salary']].sort_
values('experience',ascend ing=False)) elif opt==8:
print(DF.sort_values('s
print(DF.sort_values('salary',ascen
sub=input("enter
subject name")
print(DF[DF.subject==sub])
elif opt==11:
x=DF.facultyname
y=DF.salary
pl.title('Salary of Faculty
elif opt==-1:
break
else:
elifch==3:
DF=pd.read_csv("result.csv",index_
opt!=-1:
print()
print('='*60)
print(" RESULT DETAILS ")
print('='*60)
print(" 1. Add new student marks")
Descending") print(" 6.
opt=int(input("enter
your choice")) if
opt==1:
e=int(input("Enter stid
")) s=input("enter
semester ")
DF.loc[e]=[s,c,im,em]
DF.to_csv("result.csv") print(DF)
DF.to_csv("result.csv") print(DF)
print("Student marks
changed") elif
opt==3: print(DF)
elif opt==4:
print(DF.sort_values('externa
print(DF.sort_values('external marks',
h=int(input("enter a semester"))
print(DF[['course','semester']].groupby('se
s=int(input('Enter semester
'))
print(DF[DF.semester==s])
elif opt==8:
x=DF.index
y=DF['internal marks']
opt==-1:
break
else:
elifch==4:
DF=pd.read_csv("fees.csv",index_
opt!=-1:
print()
print("1. Add new student fees
fee_amount")
Exit") print()
opt=int(input("enter
your choice")) if
opt==1:
r=int(input('Enter
") m=input("enter
month ")
DF.loc[r]=[c,rd,fa,m]
DF.to_csv("fees.csv")
print(DF)
rue)
DF.to_csv("fees.csv")
print(DF)
print("Student fees
changed") elif
opt==3: print(DF)
elif opt==4:
print(DF.sort_value
s('amount')) elif
opt==5:
print(DF.sort_values('amount',
r')
print(DF1.semester.count()
) elif opt==7:
c=int(input("Enter
semester "))
print(DF[DF.semester==c])
elif opt==8:
fo=int(input("Enter
amount "))
print(DF[DF.amount
x=DF.amount
pl.hist(x,bins=5)
semesters',fontsize=16) pl.show()
elif opt==-1:
break
else:
print("choose the
else:
print('Thank you')
Outputs
Bibliography
1. Informatics Practices – Sumita Arora
2. www.python.org
3. www.google.org