Write a python program to write the Csv file with the data contains about reservation details of 50 passengers
Answers
Answered by
1
Answer:
import pandas as pd
# we will use pandas module for this
name_of_passengers = []
# creating an empty list
for app in range(50):
n = input("Enter name of passenger - ")
name_of_passenger.append(n)
# now appending the elements by user input
Data = pd.DataFrame(name_of_passengers)
# conventing our list to DataFrame
print("Your Data - ")
print(Data)
# printing our data to check
Data.to_csv("PassengersReserve.csv")
# a passengersReserve.csv file is created on working directory
Hope you will be satisfied by this answer so please mark this answer as brain list and you can also ask me questions related to Data Science, Python, Machine Learning etc. Enjoy Brainly :)
Similar questions