Information Practices Project
Information Practices Project
Kps
Submitted by
Pramesh Khadka
Certificate
This is to certify that this work entitled Hotel
Management System was done under my guidance
and submitted on:_________
'''
import pandas as pd
import matplotlib.pyplot as plt
import os
if choice == 1:
# Insert Booking
room_no = input("Enter Room No: ")
guest_name = input("Enter Guest Name: ")
check_in_date = input("Enter Check-in Date (YYYY-MM-DD):
")
stay_duration = int(input("Enter Stay Duration (days): "))
room_charges = float(input("Enter Room Charges (per day):
"))
df = df.append({"Room No": room_no, "Guest Name":
guest_name, "Check-in Date": check_in_date,
"Stay Duration": stay_duration,
"Room Charges": room_charges},
ignore_index=True)
df.to_csv(file_name, index=False)
print("Booking added successfully.")
elif choice == 2:
# Update Booking
room_no = input("Enter Room No to update: ")
if room_no in df["Room No"].astype(str).values:
while True:
print("Select from the following options:")
print("1. Update Guest Name")
print("2. Update Check-in Date (YYYY-MM-DD)")
print("3. Update Stay Duration (days)")
print("4. Update Room Charges (per day)")
print("5. Exit")
ch = int(input("Enter your choice: "))
if ch==1:
guest_name = input("Enter New Guest Name: ")
df.loc[df["Room No"].astype(str) == room_no, "Guest
Name"] = guest_name
print("Name updated successfully!")
elif ch==2:
check_in_date = input("Enter New Check-in Date
(YYYY-MM-DD): ")
df.loc[df["Room No"].astype(str) == room_no,
"Check-in Date"] = check_in_date
print("check_in_date updated successfully!")
elif ch==3:
stay_duration = int(input("Enter New Stay Duration
(days): "))
df.loc[df["Room No"].astype(str) == room_no, "Stay
Duration"] = stay_duration
print("Stay Duration updated successfully!")
elif ch==4:
room_charges = float(input("Enter New Room
Charges (per day): "))
df.loc[df["Room No"].astype(str) == room_no, "Room
Charges"] = room_charges
print("Room Charges updated successfully!")
elif ch==5:
print("Exiting... Goodbye!")
break
df.to_csv(file_name, index=False)
print("Booking updated successfully.")
else:
print("Invalid choice. Please try again.")
else:
print("Room No not found.")
elif choice == 3:
# Delete Booking
room_no = input("Enter Room No to delete: ")
if room_no in df["Room No"].astype(str).values:
df = df[df["Room No"].astype(str) != room_no]
df.to_csv(file_name, index=False)
print("Booking deleted successfully.")
else:
print("Room No not found.")
elif choice == 4:
# Search Booking
room_no = input("Enter Room No to search: ")
if room_no in df["Room No"].astype(str).values:
print(df[df["Room No"].astype(str) == room_no])
else:
print("Room No not found.")
elif choice == 5:
# Sort Bookings
print("1. Sort by Room No")
print("2. Sort by Guest Name")
print("3. Sort by Check-in Date")
print("4. Sort by Stay Duration")
print("5. Sort by Room Charges")
sort_choice = int(input("Enter your choice: "))
if sort_choice == 1:
print(df.sort_values("Room No"))
elif sort_choice == 2:
print(df.sort_values("Guest Name"))
elif sort_choice == 3:
print(df.sort_values("Check-in Date"))
elif sort_choice == 4:
print(df.sort_values("Stay Duration"))
elif sort_choice == 5:
print(df.sort_values("Room Charges", ascending=False))
else:
print("Invalid choice.")
df.to_csv(file_name, index=False)
elif choice == 6:
# Display Data and Graph
print(df)
print("\n1. Line Chart")
print("2. Bar Graph")
graph_choice = int(input("Enter your choice: "))
if graph_choice == 1:
plt.plot(df["Room No"], df["Room Charges"], marker="o")
plt.title("Room Charges (Line Chart)")
plt.xlabel("Room No")
plt.ylabel("Room Charges")
elif graph_choice == 2:
plt.bar(df["Room No"], df["Room Charges"],
color="skyblue")
plt.title("Room Charges (Bar Graph)")
plt.xlabel("Room No")
plt.ylabel("Room Charges")
else:
print("Invalid choice.")
continue
plt.show()
elif choice == 7:
print("Exiting... Goodbye!")
break
else:
print("Invalid choice. Please try again.")
Examples:
Thank you