0% found this document useful (0 votes)
6 views

Reservation

Uploaded by

shimonejames72
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Reservation

Uploaded by

shimonejames72
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Coding of my project

#Project Report on Student Data through CSV files and


Data Frames

import time as tt
import pandas as pd
import matplotlib.pyplot as plt

def function1() :
#Reading values from CSV data file and Printing
individual Air Ticket Reservation
data = pd.read_csv("c:\python\Tickets.csv")

#Finding out total no of records


ln=int(len(data.index))

Nm=(data["Name Of The Passangers"])


ag=(data["Age Of Passangers"])
Cit=(data["Name Of Your City"])
Bopa=(data["Boarding Place"])
Dest=(data["Your Destination"])
Dur=(data["Duration"])

for a in range(ln):

print ("* * * Welcome To The Air Ticket


Reservation***")
print (' J A B A L P U R ')
print ('---------------------------------------------------')
print ('Name Of The Passangers :', nm[a])
print ('Age Of Passangers :',ag[a])
print ('---------------------------------------------------')
print (' ')
print ('Name Of Your City',cit[a])
print ('Boarding Place ',bopa[a])
print ('Your Destination',Dest[a])
print
("=============================")
print ("Total marks = ",tot[a])
av=tot[a]/3
if ( av>=60):
print('Result : First Division')
if (av<60) and (av>=50) :
print('Result : Second Division ')
if (av<50) and (av>=40):
print('Result : Third division')
if (av<40) :
print('Result : Fail ')
print
("=============================")
tt.sleep(1.5)
print ("Thanks for using my application")

def function2() :
# Writing a new record in CSV file
data = pd.read_csv("c:\python\class.csv")
Rno=int(input("Enter Roll number "))
Name=input("Enter name of a Student")
Eng=int(input("Enter English Marks"))
Hin=int(input("Enter Hindi Marks"))
Ip=int(input("Enter IP marks"))
Tot=int(Eng+Hin+Ip)
data.loc[len(data.index)]=[Rno,Name,Eng,Hin,Ip,Tot]
#print(data)
data.to_csv("c:\python\class.csv", index= False)

def function3():
#Finding out no of records in a Data Frame
data = pd.read_csv("c:\python\class.csv")
ln=int(len(data.index))
print("Total number of records in CSV data file = ",ln)
def function4():
# Printing a summary report of a class
data = pd.read_csv("c:\python\class.csv")
ln=int(len(data.index))
rn=(data["Rno"])
nm=(data["Name"])
english=(data["Eng"])
hindi=(data["Hin"])
inpr =(data["Ip"])
tot=(data["Total"])
print ("* * * Christ Church Boys' Senior Secondary
School")
print (' J A B A L P U R ')
print ('---------------------------------------------------')
for a in range(ln):
print(rn[a],nm[a],english[a],hindi[a],inpr[a],tot[a])
print('------------------------------------------------')
print('Report Generated by S S Jassal ...')

print('==============================
===================')

def function5():
#Displaying student data through Bar Graph
data = pd.read_csv("c:\python\class.csv")

x=(data["Name"])
y=(data["Total"])

plt.bar(x,y, color='orange',label='English')
plt.xlabel('Students')
plt.ylabel('Max.Marks 300')
plt.title('Student progress analysis')
plt.legend()
plt.show()
def function6():
data = pd.read_csv("c:\python\
class.csv",index_col="Rno")
print(data)
roll=int(input("Enter roll number to delete"))
data.drop([roll],inplace=True)
print(data)
data.to_csv("c:\python\class.csv")

# Main Menu Driven Program


ans='y'
while (ans=='y') or (ans=='Y'):
print(' * * * * * Main Menu * * * * *')
print('-------------------------------------------------')
print('Select any one of the following options')
print(' 1.... for Marks Sheet')
print(' 2.... New Entry in file')
print(' 3.... for Finding no of records')
print(' 4.... for Summary Report ')
print(' 5.... for Generating Bar Graph Student
wise')
print(' 6.... for Deleting a particular record')

op=int(input("Enter your Choice 1....6 ?"))


if (op==1):
function1()

if (op==2):
function2()

if (op==3):
function3()

if (op==4):
function4()
if (op==5):
function5()

if (op==6):
function6()

ans=input("Want to continue...Y/N ?")

If we choose option 4 it will give the following output:

You might also like