PROJECT
ON
RAILWAYS
RESERVATION SYSTEM
1
TABLE OF CONTENT
• AIM
• INTRODUCTION
• THEORETICAL BACKGROUND
• HARDWARE AND SOFTWARE
• LIST OF REPORTS
• CSV FILE
• CODING AND OUTPUT OF PROJECT
• CONCLUSION
• BIBLOGRAPHY
2
AIM
The main objective of the Railway Reservation System is to manage the
details of Train, Booking ,Payment , Seat, Ticket. It manages all the
information about Train, Customer, Ticket, Train. The project is totally
built at administrative end and thus only the administrator is guaranteed the
access. The purpose of the project is to build an application program to re
duce the manual work for managing the Train, Booking, Customer,
Payment. It tracks all the details about the Payment,Seat,Ticket.
INTRODUCTION
This Project Has Been Made For Storing Data Of Railways Reservation
With Sub Division Name ,Ticket Fair,Train Name ,Train Enquiry, Etc Of
Every Train .It Contain Different Types Of Graphs ,Reports.
THEORETICAL BACKGROUND
❖WHAT IS PYTHON?
3
Python is an interpreted, object-oriented, high-level programming language with
dynamic semantics. Its high-level built in data structures, combined with dynamic
typing and dynamic binding; make it very attractive for Rapid Application
Development, as well as for use as a scripting or glue language to connect existing
components together. Python's simple, easy to learn syntax emphasizes readability
and therefore reduces the cost of program maintenance. Python supports modules
and packages, which encourages program modularity and code reuse. The Python
interpreter and the extensive standard library are available in source or binary form
without charge for all major platforms, and can be freely distributed.
Often, programmers fall in love with Python because of the increased productivity
it provides. Debugging Python programs is easy: a bug or bad input will never
cause a segmentation fault. Instead, when the interpreter discovers an error, it raises
an exception. A source level debugger allows inspection of local and global
variables, evaluation of arbitrary expressions, setting breakpoints, stepping through
the code a line at a time, and so on. The debugger is written in Python itself,
testifying to Python's introspective power. On the other hand, often the quickest
way to debug a program is to add a few print statements to the source: the fast edit-
test-debug cycle makes this simple approach very effective.
What is Pandas?
Pandas is Python’s library for data analysis. Pandas has derived its name from
“Panel Data System” and its has become very popular choice for data analysis.
Data Analysis refers to process of evaluating big data sets using analytical and
statistical tools so as to discover useful information and
conclusions to support business decision making.
While working with Pandas, it is required to import Pandas and numpy both by
writing:
4
import pandas as pd
importnumpy as np
Pandas is best at handling huge tabular data sets comprising different data
formats.
Pandas provide two data structures for storing data:
a) Series
b) Dataframe
Data visualization
Data visualization “A picture is worth a thousand words”. Most of us are familiar
with thisexpression. Data visualization plays an essential role in the representation
of both small andlarge-scale data. It especially applies when trying to explain the
analysis of increasingly large
datasets. Data visualization is the discipline of trying to expose the data to
understand it byplacing it in a visual context. Its main goal is to distill large datasets
into visual graphics toallow for easy understanding of complex relationships within
the data. Several datavisualization libraries are available in Python, namely
Matplotlib, Seaborn, and Folium etc.
Purpose of Data visualization
• Better analysis
• Quick action
• Identifying patterns
• Finding errors
• Understanding the story
• Exploring business insights
• Grasping the Latest Trends
What is [Link]
5
Matplotlib is the whole python package/ library used to create 2D graphs and plots
by using python scripts. pyplot is a module in matplotlib, which supports a very
wide variety of graphs and plots namely - histogram, bar charts, power spectra,
error charts etc. It is used along with NumPy to provide an environment for
MatLab. Pyplot provides the state-machine interface to the plotting library in
[Link] means that figures and axes are implicitly and automatically created to
achieve the desired plot. For example, calling plot from pyplot will automatically
create the necessary figure and axes to achieve the desired plot.
6
HARDWARE AND SOFTWARE REQUIREMENT
HARDWARE SYSTEM:
OS- Windows 7 Professional 32-Bit (6.1, Build 7601)
Language: English
System Manufacture-Gigabyte Technology Co., Ltd
BIOS:-BIOS Date: 08/03/13 09:45:07
Ver: 04.06.05
Processor:- Intel (R) Core ™ i3-3220CPU
@3.30 GHz (4CPUs), ~3.3GHz
Memory: 2048 MB RAM
DirectX Version: Direct XII 22
DISPLAY DEVICE:
Name:-Intel(R) HD Graphics
Manufacturer: - Gigabyte Technology Co., Ltd
Chip Type: - Intel(R) HD Graphics Family
DAC Type:-Internal
Approx. Total Memory:-775 MB
Current Display mode: - 1336 X 768
(32 Bit)(60Hz)
Monitor:- Generic PnP Monitor 23
SOFTWARE REQUIREMENT:
• Windows 2000/XP OS is desirable.
• Python IDLE Ver 3.7.2 or higher should be installed.
• MySQL 8.0 should be installed.
• PANDAS Library with [Link] be present at machine.
7
Csv file
Train
Passenger
Schedule
8
CODING
import pandas as pd
import [Link] as plt
def menu():
print()
print("**************************************************************
***************************************")
print(" RAILWAYS RESERVATION SYSTEM
PROJECT ")
print("**************************************************************
****************************************")
print()
print("[Link] about the project")
print("[Link] file train")
print("[Link] new train details in file ")
print("[Link] of all train")
print("[Link] no of train ")
print("[Link] tarin by number of train")
9
print("[Link] Fare")
print("[Link] Enquiry")
print("[Link] Train")
print("[Link] in Arrival")
print("[Link] Passengers File")
print("[Link] New passenger 's Detail in File")
print("[Link] Reservation ")
print("[Link] status of the Ticket")
print("[Link] and Bottom Records from passenger")
print("[Link] plot")
print("[Link] Plot")
print("[Link] Plot")
print("[Link] Plot")
print("[Link] Plot")
print("[Link] Plot")
print("**************************************************************
****************************************")
menu()
10
def about():
print("The project is developed on RAILWAY RESERVATION [Link]
contains 20 options.\
In the project 3 CSV Files are used...Train , passengers and schedule.")
def read_train():
print('Reading details of file Train')
print()
print()
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]",index_col=0)
print(df)
def new_train():
print("Adding new train in file train")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]",index_col=0)
print(df)
a=int(input("Enter train number:"))
b=(input("Enter train name:"))
c=(input("Enter source:"))
d=(input("Enter destination:"))
11
e=(input("enter ac fare:"))
f=(input("Enter sleeper fare:"))
[Link][a]=[b,c,d,e,f]
print(df)
def schedule():
print( "Schedule of ALL Trains")
print()
df=pd. read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]",index_col=0)
print(df)
def totaltrains():
print( 'Find Total Trains ')
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
def sort_trainno():
print('sorting Train No. of Trains in Descending order')
print()
df=pd.read_csv ("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]", index_col=0)
df=df.sort_values( 'tnum', ascending=False)
12
print(df)
def fare():
print( 'sorting Trains Names in Ascending order and show Fares ')
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]", index_col=0,usecols=['tname','Ac','slp'])
df=df.sort_values('tname')
print(df)
def enquiry():
print( 'Find out Arrival Time of a Train')
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]", index_col=0)
print(df)
print()
#print([Link][df['tnum']==5353])
def canceltrain():
print("delete medicine from file stock")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]",index_col=0)
print(df)
tnum=int(input("enter the train number :"))
13
[Link](tnum,axis=0,inplace=True)
print("record of train temporarily deleted")
print()
print(df)
def changetiming():
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print("previous timings of arrival")
print()
print(df)
print()
[Link][df['tnum']==5353,['arrival']]=df['arrival']+':40'
#print(df)
print()
#df["bal"]=df["bal"]-3000
print(df)
def read_passengers():
print("reading file passenger")
print()
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
14
print(df)
def new_passengers():
print("adding new passenger in file passenger")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]",index_col=0)
print(df)
n=(input("enter the passenger name : "))
a=int(input("enter the age: "))
tn=int(input("enter train no. :"))
noofp=int(input("enter the number of passenger: "))
c=(input("enter the class : "))
d=(input("enter the destination: "))
amt=int(input("enter the amount: "))
s=d=(input("enter the status : "))
pnr=(input("enter the pnr no.: "))
[Link][n]=[a,tn,noofp,c,d,amt,s,pnr]
print(df)
def ticketreservation():
print("WE HAVE A FOLLOWING SEAT TYPE FOR YOU:-")
print("TNUMBER IS 1 FOR GOA EXPRESS FROM NEW DELHI:-")
15
print()
print("[Link] CLASS AC RS 6000 PER PERSON")
print("2. FOR SLEEPER RS 3000 PER PERSON")
print("TNUMBER IS 2 FOR JAMMU EXPRESS FROM NEW DELHI:-")
print("1. FIRST CLASS AC RS 10000 PER PERSON")
print("2. FOR SLEEPER RS 7000 PER PERSON")
tname=(input("enter your choice of train name please-"))
print(tname)
x=int(input("enter your choice of ticket please"))
n=int(input("how many ticket you need:"))
if(x==1):
print("you have chosen first class ac ticket")
s=6000*n
elif(x==2):
print("you have chosen sleeper ticket")
s=3000*n
else:
print("invalid option")
print("please chose a train")
print("your total ticket price is =",s,"\n")
16
if(x==1):
print("you have chosen the first class ac ticket")
s=10000*n
elif(x==2):
print("you have chosen sleeper ticket")
s=7000*n
else:
print("invalid option")
print("please choice a train")
print("your total ticket price is =",s,"\n")
def status():
print("show the status of ticket")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]",usecols=['pname','status'])
print(df)
def top_bottom():
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print('top 2 row')
print([Link](2))
print()
17
print()
print("last 2 row")
print([Link](2))
def line_plot():
print("line plot")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
x=df['tname']
y=df['Ac']
[Link]('ac fare for train ',fontsize=14,color="r")
[Link]("trains",fontsize=14,color="r")
[Link]("ac fare",fontsize=14,color="r")
[Link](x,y,marker="x",ls="dashed",linewidth=4,color="g")
[Link]()
def line1_plot():
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
[Link](df['tname'],df['slp'],marker='o',label="fare")
[Link]("sleeper fare for trains",fontsize=14,color="r")
18
[Link]("trains",fontsize=14,color="r")
[Link]("sleeper fare",fontsize=14,color="r")
[Link](rotation=30)
[Link]()
[Link](True)
[Link]()
def bar_plot():
print("bar plot")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
x=df["tname"]
y=df["slp"]
[Link]("sleeper fare for trains",fontsize=14,color="r")
[Link]("trains",fontsize=14,color="r")
[Link]("sleeper fare",fontsize=14,color="r")
[Link](rotation= 30)
[Link](x,y,color=['red','yellow'])
[Link]()
19
def bar1_plot():
print('bar plot')
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
x=df['tname']
y=df['Ac']
[Link]('sleeper fare for trains',fontsize=14,color="g")
[Link]("trains",fontsize=14,color="g")
[Link]("ac fare",fontsize=14,color="g")
[Link](rotation=30)
[Link](x,y,color=["orange","blue"])
[Link]()
def barh_plot():
print('horizontal bar plot')
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
x=df['tname']
y=df['slp']
20
[Link]('sleeper fare for trains',fontsize=14,color="b")
[Link]('trains',fontsize=14,color='b')
[Link]('sleeper fare',fontsize=14,color="b")
[Link](x,y,color='blue',edgecolor="pink")
[Link]()
def barh1_plot():
print("horizontal bar plot")
df=pd.read_csv("C:\\Users\\Lucky\\Desktop\\rohan and yashika
kateria\\[Link]")
print(df)
x=df["tname"]
y=df["slp"]
[Link]("sleeper fare for trains",fontsize=14,color="r")
[Link]('train',fontsize=14,color="r")
[Link]("ac fare",fontsize=14,color="r")
[Link](x,y,color="orange",edgecolor="red")
[Link]()
opt=""
opt=int(input("enter your choice : "))
21
if opt==0:
about()
if opt==1:
read_train()
elif opt==2:
new_train()
elif opt==3:
schedule()
elif opt==4:
totaltrains()
elif opt==5:
sort_trainno()
elif opt==6:
fare()
elif opt==7:
enquiry()
elif opt==8:
canceltrain()
22
elif opt==9:
changetiming()
elif opt==10:
read_passengers()
elif opt==11:
new_passengers()
elif opt==12:
ticketreservation()
elif opt==13:
status()
elif opt==14:
top_bottom()
elif opt==15:
line_plot()
elif opt==16:
line1_plot()
elif opt==17:
bar_plot()
23
elif opt==18:
bar1_plot()
elif opt==19:
barh_plot()
elif opt==20:
barh1_plot()
else:
print("invalid option")
print("\a")
24
OUTPUT
25
26
27
28
29
30
31
GRAPH
32
GRAPH
33
GRAPH
34
GRAPH
35
GRAPH
36
GRAPH
37
BIBLOGRAPHY
INFORMATICS PRACTICES SUMITA ARORA CLASS XII
INFORMATICS PRACTICES SUMITA ARORA CLASS XI
[Link]
COLAB PLATFORM
38