Affiliated to c
Affiliated to c
AFFILIATED TO C.B.S.E
Project File
Session :- 2024-25
2. Current.csv :
3. Cost.csv :
SOURCE CODE
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
print('=' * 50)
print("\t\t Parking Lot")
print('=' * 50)
df = pd.read_csv("Current.csv",
index_col="Spot No")
df2 = pd.read_csv("Cost.csv",
index_col="Vehicle id")
df3 = pd.read_csv("Records.csv")
k=1
while k == 1:
print('Press 1 - Add a New Record')
print('Press 2 - Show Current records')
print('Press 3 - Search for a record')
print('Press 4 - See all records')
print('Press 5 - To search for a empty parking
spot')
print('Press 6 - To See Graph of Parking
Prices')
print('Press 7 - To Add Exit Date ')
print('Press 8 - To Add Vehicle Type')
print('Press 9 - To See Vehicle Price List')
print('Press 10 - To Delete record from
current records')
print('Press 11 - To Exit')
x = int(input("Enter Your Choice:"))
if x == 1:
Spot = int(input("Enter The Spot Number:
"))
if Spot in df.index:
print("Sorry This Spot Is Taken")
else:
Name = str(input("Enter The Owners
Name: "))
Vname = str(input("Enter The Vehicle
Name: "))
Vnumber = str(input("Enter The Vehicle
Number: "))
Vid = int(input("Enter The Vehicle id: "))
EntDate = str(input("Enter The Entry
Date: "))
df.loc[Spot] = [Name, Vname, Vnumber,
Vid,
df2.loc[Vid, 'Cost'],
EntDate,np.nan]
print("Record Added Successfully")
df.to_csv("Current.csv")
elif x == 2:
print(df)
elif x == 3:
print("Ways to search for Record:")
print('''\t\t 1. Spot Number
2. Owner Name
3. Vehicle Number
4. Entry Date''')
if n == 1:
Serial = int(input("Enter the Spot
Number: "))
if Serial in df.index:
print(df.loc[Serial])
print("\n")
else:
print("No Car is at the Spot")
elif n == 2:
owner = str(input("Enter the Owner
Name: "))
result = df[df['Owner Name'] == owner]
if not result.empty:
print(result)
else:
print("No records found for the given
Owner Name.")
elif n == 3:
vehicle_num = str(input("Enter the
Vehicle Number: "))
result = df[df['Vehicle Number'] ==
vehicle_num]
if not result.empty:
print(result)
else:
print("No records found for the given
Vehicle Number.")
elif n == 4:
entry_date = input("Enter the Entry
Date (DD-MM-YYYY): ")
result = df[df['Entry Date'] ==
entry_date]
if not result.empty:
print(result)
else:
print("No records found for the given
Entry Date.")
else:
print("Invalid option selected. Please
choose between 1 and 4.")
elif x == 4:
print('=' * 100)
print(df3)
print('=' * 100)
elif x == 5:
a = list(range(1, 13))
for i in range(1, 13):
if i in df.index:
a.remove(i)
else:
pass
print("The Following Spots are empty: ")
print(*a, sep=",")
print("\n")
elif x == 6:
plt.bar(df2["Vehicle Name"], df2["Cost"],
color=’b’, edgecolor='black', label='Cost',
width=0.5)
plt.legend()
plt.title("Vehicles and their costs")
plt.show()
elif x == 7:
Slot = int(input("Enter The Spot Number:
"))
if Slot in df.index:
ExtDate = str(input("Enter The Exit
Date: "))
df.loc[Slot, "Exit Date"] = ExtDate
record = df.loc[Slot].to_frame().T
record.reset_index(inplace=True)
record.rename(columns={"index": "Spot
No"}, inplace=True)
df3 = pd.concat([df3, record],
ignore_index=True)
df3.index = range(1, len(df3) + 1)
df3.to_csv("Records.csv", index=False)
df.drop(Slot, inplace=True)
df.to_csv("Current.csv")
print("Record for Spot", Slot, " has been
moved to Records.csv")
else:
print("No record found for the given
Spot Number.")
elif x == 8:
Vid = int(input("Enter The id of the
Vehicle: "))
if Vid in df2.index:
print("Already a Vehicle is registered at
that id")
else:
Vname = str(input("Enter The Vehicle
Name: "))
Cost = int(input("Enter The Cost: "))
df2.loc[Vid] = [Vname, Cost]
df2.to_csv("Cost.csv")
print(“Vehicle has been added”)
elif x == 9:
print('=' * 50)
print(df2)
print('=' * 50)
elif x == 10:
print("Ways to Delete for Record:")
print('''\t1. Spot Number
2. Owner Name
3. Vehicle Number
4. Entry Date''')
n = int(input("Enter the way you want to
Delete the Record: "))
if n == 1:
Serial = int(input("Enter the Spot
Number: "))
if Serial in df.index:
df.drop(Serial, inplace=True)
print("The Record has been deleted
successfully.")
df.to_csv("Current.csv", index=True)
print("\n")
else:
print("No car is at the specified
spot.")
elif n == 2:
owner = str(input("Enter the Owner
Name: "))
result = df[df['Owner Name'] == owner]
if not result.empty:
df.drop(result.index, inplace=True)
print("The Record has been deleted
successfully.")
df.to_csv("Current.csv", index=True)
else:
print("No records found for the given
Owner Name.")
elif n == 3:
vehicle_num = str(input("Enter the
Vehicle Number: "))
result = df[df['Vehicle Number'] ==
vehicle_num]
if not result.empty:
df.drop(result.index, inplace=True)
print("The Record has been deleted
successfully.")
df.to_csv("Current.csv", index=True)
else:
print("No records found for the given
Vehicle Number.")
elif n == 4:
entry_date = str(input("Enter the Entry
Date (DD-MM-YYYY): "))
result = df[df['Entry Date'] ==
entry_date]
if not result.empty:
df.drop(result.index, inplace=True)
print("The Record has been deleted
successfully.")
df.to_csv("Current.csv", index=True)
else:
print("No records found for the given
Entry Date.")
else:
print("Invalid option selected. Please
choose between 1 and 4.")
elif x == 11:
k=0
print('*' * 50)
print("Thanks For Visiting")
print('*' * 50)
PROPOSED
METHODOLOGY AND
IMPLEMENTATION
The Vehicle Parking System is designed to maintain
records and details of the vehicles being entered and
left. It allows the user to view all current records and
old records too and add vehicles exit date and it
automatically moves to old records. The Vehicle
Parking
System contains details of vehicles such as :-
Vehicle List :