You are on page 1of 21

CONTENTS:-

 CERTIFICATE
 ACKNOWLEDGEMENT
 ABOUT PYTHON
 WHAT IS CSV FILE?
 INTRODUCTION OF PROJECT
 SOURCE CODE
 OUTPUTS
 GRAPH
 BIBLIOGRAPHY
ABOUT PYTHON

PYTHON is an interpreted, high-level, python general-purpose


programming language. Created by Guido van rossum and first
released in 1991, python's design philosophy emphasizes code
readability with its notable use of significant whitespace. Its
language constructs and object-oriented approach aim to help
programmers write clear, logical code for small and large-scale
projects.
Python is dynamically typed and garbage-collected. It supports
multiple programming paradigms, including procedural, object-
oriented, and functional programming. Python is often
described as a "batteries included" language due to its
comprehensive standard library.
Python was conceived in the late 1980s as a successor to the
ABC language. Python 2.0, released in 2000, introduced features
like list comprehensions and a garbage collection system
capable of collecting reference cycles. Python 3.0, released in
2008, was a major revision of the language that is not
completely backward-compatible, and much python 2 code
does not run unmodified on python 3.
The python 2 language, i.e. Python 2.7.X, was officially
discontinued on January 1, 2020 (first planned for 2015) after
which security patches and other improvements will not be
released for it.
With python 2’s end-of-life, only Python 3.5.x and later are
supported.
Python interpreters are available for many operating systems.
A global community of programmers develops and maintains
python an open source [321 reference implementation. A non-
profit organization, the Python Software Foundation, manages
and directs resources for Python and Python development.

HISTORY OF PYTHON
Python was conceived in the late 1980s[by Guido van Rossum
at Centrum Wiskunde & Informatics (CWI) in the Netherlands as
a successor to the ABC language (itself inspired by SETL),
capable of exception handling and interfacing with the Amoeba
operating system. Its implementation began in December
1989.(35] Van Rossum shouldered sole responsibility for the
project, as the lead developer, until July 12, 2018, when he
announced his permanent vacation responsibilities as Python's
Benevolent Dictator For Life, a title the Python community
bestowed upon him to reflect his long-term commitment as the
project's chief decision-maker. He now shares his leadership as
a member of a five person steering council.
 What is CSV file?
A CSV is a comma-separated values file, which allows data to be
saved in a tabular format. CSVs look like a garden-variety
spreadsheet but with a .csv extension.
CSV files can be used with most any spreadsheet program, such
as Microsoft Excel or Google Spreadsheets. They differ from
other spreadsheet file types because you can only have a single
sheet in a file, they cannot save cell, column, or row. Also, you
cannot save formulas in this format.

• Why are CSV files used?


These files serve a number of different business purposes. They
help companies export a high volume of data to a more
concentrated database, for instance.
They also serve two other primary business functions:
CSV files are plain-text files, making them easier for the website
developer to create.
Since they're plain text, they're easier to import into a
spreadsheet or another storage database, regardless of the
specific software you're using
To better organize large amounts of data
CSV FILES:-

TRAIN ROUTE ; FILE NAME:- CSVM.CSV

RESERVATION DETAILS ; FILE NAME:-CSVN.CSV


ABOUT RAILWAY RESERVATION SYSTEM
Railway Reservation System is developed for to automate the railway reservation
system. It includes modules required to successfully operate railway reversion process
smoothly. It has train master to add modify train information, Train schedule to enter
train journey details include all the station name, arrival time and departure time. It
includes automatic fare calculation as per the distance between two stations .

Reservation module consists of automatic seat no and coaches no allocation system.


Daily schedule for updating of not confirm seat and coach no. All master like train
master, train schedule, reservation fees, cancellation fees charges can be modified
individually from front end and changes reflect in all modules immediately .

Therefore proposed "Railway Reservation System" has been designed to automate the
process of railway for ticket reservation and back office activities. System can make the
daily activities efficient and providing the fast response.

OBJECTIVES
Our project introduces railway reservation system with an objective to make the
reservation system more efficient, easier and fast. This project explores how computer
technology can be used to solve the problem of user. The main objectives provided by
this software are as follows:
 To enquire about availability of trains
 To reserve and cancel their seats
 To modify the information related to
 To show all the reservation
 To show the passenger name record(PNR)

Working
We have taken two CSV files namely CSVM.csv (Train Route) and CSVN.csv
(Reservation details).

With python pandas program and data from CSV files we have completed this
project.
LIMITATIONS OF EXISTING SYSTEM: -

 Data redundancy:

It means that same data fields appear in many different files and often in different
formats. In manual system, it poses quite a big problem because the data has to be
maintained in large volumes but in our system, this problem can be overcome by
providing the condition that if the data entered is duplicate, it will not be entered,
otherwise, updating will take place.

 Difficulty in accessing the data:


In manual system, searching information is time consuming but in our system, any
information can be accessed by providing the primary key.

 Unsatisfactory security measures


In manual system, no security measures were provided but in this system,
password security has been provided. The person can access the system by
providing the correct password otherwise he is denied the access
#program on train reservation (project 2020 -2021)
import pandas as pd
import numpy as np
import sys
import random
print(' '*8,".....welcome to reservcation online.....")
print()
print()
while(True):
df=pd.read_csv("C:/Documents/CSVM.csv",index _col="sno")
lf=pd.read_csv("C:/Documents/CSVN.csv",index_col="pnr_no")
def writcsv(lf):
lf.to_csv("C:/Documents/CSVN.csv",na_rep='NULL')
def writecsv(df):
df.to_csv("C:/Documents/CSVM.csv",na_rep='NULL')
print('''1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT''')
option=int(input("Select your option:"))
if option==1:
print()
print(pd.read_csv("C:/Documents/CSVM.csv"))
print()
sno=int(input("enter s.no"))
print()
train_no=int(input("enter train no."))
print()
train_name=input("enter train name")
print()
start=input("enter train start station")
print()
end=input("enter train end station")
print()
df.loc[sno,:]=[train_no,train_name,start,end]
writecsv(df)
print(' '*10,"processing...")
print()
print()
elif option==2:
print()
print(df)
print()
sno=int(input("enter s.no to be removed"))
print()
df.drop(sno,axis=0,inplace=True)
writecsv(df)
print('processing...')
print()
print()
print(df)
print()
print()
elif option==3:
print()
name=input("enter your name")
print()
age=int(input("enter your age"))
print()
way_from=input("enter way from station")
print()
way_to=input("enter way to station")
print()
pnr_no=random.randint(111111,999999)
fare=random.randint(500,1500)
conformation='y'
lf.loc[pnr_no,:]=[name,age,way_from,way_to,conformation,fare]
writcsv(lf)
print('processing...')
print()
print()
print(lf)
print()
print()
elif option==4:
print()
print(lf)
print()
print()
elif option==5:
print(' '*10,'*** |__| PNR_NO |__| ***')
print()
print(pd.Series(lf.index))
print()
print()
pnr_no=int(input("enter your pnr_no."))
print()
detail=lf.loc[pnr_no,:]
print()
print(' '*10,'Details related with this ',pnr_no,'is...')
print()
print()
print(detail)
print()
print()
else:
sys.exit()
enter=input('press enter:')
print()
print(' '*10,'reservation details...')
print()
print()
print(lf)
print()
print()
print(' '*10,'train details...')
print()
print()
print(df)
print()
print()
if(input('do u want ot continue y/n')=='n'):
break
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\python\Python38\ip project board.py
===============
.....welcome to Reservation online.....

1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\python\Python38\ip project board.py
===============
.....welcome to Reservation online.....

1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:1

sno train_no train_name start end


0 4 65478 durg bilaspur DURG BHOPAL
1 5 52674 indore bilaspur durg bhopal

enter s.no3

enter train no.56432

enter train nameAurangabad Mumbai

enter train start stationMumbai

enter train end stationAurangabad

processing...

press enter:

reservation details...

name age way_from way_to conformation fare


pnr_no
536334 abhinav 37 shahdol mumbai y 1430
235443 ashish 19 raipur indore n 874
435435 gargi 20 pune chennai n 768
233233 tarun 50 nudhar surajpur y 850
865687 shruti 18 shahdol bhopal y 970
994536 stan 30 goa varanasi y 939
373255 sujal 19 shahdol raipur y 1279
317941 ABHINAV 18 SHAHDOL JABLPUR y 1252
129816 GARGI 17 KATNI MUMBAI y 1416

train details...
train_no train_name start end
sno
4 65478.0 durg bilaspur DURG BHOPAL
5 52674.0 indore bilaspur durg bhopal
3 56432.0 Aurangabad Mumbai Mumbai Aurangabad

do u want ot continue y/n


do u want ot continue y/ny
1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:2

train_no train_name start end


sno
4 65478.0 durg bilaspur DURG BHOPAL
5 52674.0 indore bilaspur durg bhopal
3 56432.0 Aurangabad Mumbai Mumbai Aurangabad

enter s.no to be removed5

processing...

train_no train_name start end


sno
4 65478.0 durg bilaspur DURG BHOPAL
3 56432.0 Aurangabad Mumbai Mumbai Aurangabad

press enter:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\python\Python38\ip project board.py
===============
.....welcome to Reservation online.....

1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:3

enter your namekrishna

enter your age17

enter way from stationBokaro steel city

enter way to stationMumbai

processing...

name age way_from way_to conformation fare


pnr_no
536334 abhinav 37.0 shahdol mumbai y 1430.0
235443 ashish 19.0 raipur indore n 874.0
435435 gargi 20.0 pune chennai n 768.0
233233 tarun 50.0 nudhar surajpur y 850.0
865687 shruti 18.0 shahdol bhopal y 970.0
994536 stan 30.0 goa varanasi y 939.0
373255 sujal 19.0 shahdol raipur y 1279.0
317941 ABHINAV 18.0 SHAHDOL JABLPUR y 1252.0
129816 GARGI 17.0 KATNI MUMBAI y 1416.0
866898 krishna 17.0 Bokaro steel city Mumbai y 956.0

press enter:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\python\Python38\ip project board.py
===============
.....welcome to Reservation online.....

1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:4

name age way_from way_to conformation fare


pnr_no
536334 abhinav 37.0 shahdol mumbai y 1430.0
235443 ashish 19.0 raipur indore n 8 74.0
435435 gargi 20.0 pune chennai n 768.0
233233 tarun 50.0 nudhar surajpur y 850.0
865687 shruti 18.0 shahdol bhopal y 970.0
994536 stan 30.0 goa varanasi y 939.0
373255 sujal 19.0 shahdol raipur y 1279.0
317941 ABHINAV 18.0 SHAHDOL JABLPUR y 1252.0
129816 GARGI 17.0 KATNI MUMBAI y 1416.0
866898 krishna 17.0 Bokaro steel city Mumbai y 956.0

press enter:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\python\Python38\ip project board.py
===============
.....welcome to Reservation online.....

1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:5
*** |__| PNR_NO |__| ***

0 536334
1 235443
2 435435
3 233233
4 865687
5 994536
6 373255
7 317941
8 129816
9 866898
Name: pnr_no, dtype: int64

enter your pnr_no.235443

Details related with this 235443 is...

name ashish
age 19
way_from raipur
way_to indore
conformation n
fare 874
Name: 235443, dtype: object

press enter:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\python\Python38\ip project board.py
===============
.....welcome to Reservation online.....

1)Add Train Details

2)Remove Train Detail

3)New Reservation

4)Show All Reservation Details

5)Show our Reservation Details

6)QUIT
Select your option:6
>>>
BIBLIOGRAPHY

 INFORMATICS PRACTICES BY SUMITA ARORA


(Dhantpat Rai & Co.)(XII)
 INFORMATICS PRACTICES BY PREETI ARORA
(SULTAN Chand)(XII)
 INFORMATICS PRACTICES BY SUMITA ARORA
(Dhantpat Rai & Co.)(XI)
 Core Python Programming (Kindle Edition)

You might also like