Features of Python
Features of Python
FEAUTURES:
Easy to use (user friendly): Python is compact and very
easy to use object-oriented language with very simple
syntax rules. It is a high-level programming language
that has English like syntax. This makes it easier to read
and understand the code.
Interpreted language: Python is an interpreted
language. Python interpreter interprets and executes the
code, Line by line at a time. So, it’s an easy to debug
language and thus suitable for beginners to advanced
users.
Cross-platform Language: Python can run across
different platforms like Windows, Linux, Mac Os and
other Os.
Free and Open Sources: Python is freely available,
open source, portable language. And not only is it free,
its source code (Complete program instruction) is also
available.
PYTHON PANDAS AND IT’S FEATURES
Pandas is a Python module that makes data science or data
analysis easy and effective. It is the most famous Python
package for data science that offers powerful and flexible data
structures which makes data analysis and manipulation easy.
Pandas makes data importing and data analysing easier.
Features of Pandas:
The salient features of Pandas are:
It can read or write in many different data formats (integer,
float, double, etc)
import pandas as pd
MATPLOTLIB
Hardware requirements:
Software requirements:
1. Pandas
2. Matplotlib
AIM OF THE PROJECT
This project on Student Management System aims at creating
a program which helps to read from a CSV/ Excel file,
manipulation of file like insertion and deletion, analysis of
data like displaying specific record and columns, data
visualization in the form of histogram, line chart, bar graph
etc.
The Functions that program can perform are:
1. Read CSV/Excel file
Read CSV file to create and Display Data Frame
Read Excel File to create and Display Data Frame
2. Manipulation
Insert Rows
Delete Column
3. Analysis
1. Top Records
2. Bottom Records
3. Print Particular column
4. Print Multiple columns
5. Print complete Statistics of the Data frame
4. Visualization
To display Histogram of all numeric columns.
To display the line chart for each hotel name against
total charges.
To display the Bar Chart of hotel name against total
charges
5. Exit
HOTEL MANAGEMENT SYSTEM
CSV/ Excel File:
PYTHON PROGRAM
import pandas as pd
import matplotlib.pyplot as plt
pro=input("Enter your Project title:")
while True:
print("-------------------")
print("",pro,"")
print("--------------------")
print("1.read csv/excel file")
print("2.manipulation")
print("3.analysis")
print("4.visualization")
print("5.exit")
ch=int(input("enter your choice:"))
if ch==1:
print("1.read csv file to create and display dataframe")
print("2.read excel file to create and display dataframe")
print("3.press enter to go back")
ch1=int(input("enter your choice:"))
if ch1==1:
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
print(df)
print("file retrieved successfully")
elif ch1==2:
df=pd.read_excel("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.xlsx")
print(df)
print("file retrieved successfully ")
elif ch1==3:
pass
elif ch==2:
print("1.insert rows")
print("2.delete columns")
print("3.enter to go back")
ch2=int(input("enter your choice: "))
if ch2==1:
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
col=df.columns
print(col)
print(df.head(1))
j=0
ninsert={}
for i in col:
print("enter",col[j],"value")
nval=input()
ninsert[col[j]]=nval
j=j+1
print(ninsert)
df=df.append(ninsert,ignore_index=True)
print("new row inserted")
print(df)
elif ch2==2:
co=input("enter the column name to be deleted:")
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
del df[co]
print(df)
elif ch2==3:
pass
elif ch==3:
print("dataframe analysis")
print("1.top records")
print("2.bottom records")
print("3.print particular columns")
print("4.print multiple columns")
print("5.print complete statistics of dataframe")
print("6.press enter to go back")
ch3=int(input("enter your choice:"))
if ch3==1:
n=int(input("enter the number of records to be displayed:"))
print("top",n,"records from the dataframe")
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
print(df.head(n))
elif ch3==2:
n=int(input("enter the number of records to be displayed:"))
print("bottom",n,"records from the dataframe")
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
print(df.tail(n))
elif ch3==3:
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
print("name of columns\n",df.columns)
co=input("enter the column name to be displayed")
print(df[[co]])
elif ch3==4:
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
print("name of the columns\n",df.columns)
co=eval(input("enter the column names as list in square brackets:"))
print(df[co])
elif ch3==5:
print("complete statistics")
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
print(df.describe())
elif ch3==6:
pass
else:
print("invalid choice!!!!!!")
elif ch==4:
print("data visualisation of pandas dataframe")
print("1.to display histogram of all numeric columns")
print("2.to display the line chart for hotel name against total charges")
print("3.to display the barchart of hotel name against total charges")
print("4.press enter to go back")
df=pd.read_csv("C:\\Users\\Veera Sai\\OneDrive\\Documents\\HOTELMGT.csv")
ch4=int(input("enter your choice of graph:"))
if ch4==1:
df.hist()
plt.show()
elif ch4==2:
df.plot(x="HOTELNAME",y=["ROOMCHRG"],kind='line')
plt.xlabel("hotel name")
plt.ylabel("room charges")
plt.show()
elif ch4==3:
df["TOTALCHRG"]=(df["ROOMCHRG"]+df["RESTCHRG"]/5)
df.plot(x="HOTELNAME",y="TOTALCHRG",kind="bar",color="r")
plt.xlabel("hotel name")
plt.ylabel("total charge")
plt.show()
elif ch4==4:
pass
else:
break
con=input("do you wish to continue")
if con=="n" or con=="N":
break
OUTPUT
MAIN MENU