Features of Python

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

FEATURES OF PYTHON

Python is an open source, object oriented, high-level


programming language, which was developed by Guido
Van Rossum in 1991.

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)

 Columns from a Pandas data structure can be deleted or


inserted.

 It supports group by operation for data aggregation and


transformations and allows high performance merging and
joining of data.

 It offers good IO (Input-Output) capabilities as it easily


pulls data from a MYSQL database directly into a data
frame.

 It has the functionality to find and fill missing data.

 It supports reshaping of data into different forms.

 It supports visualization by integrating libraries such as


matplotlib etc.
To import pandas library:

import pandas as pd

Data Structures in Pandas


A data structure is a way of storing and organizing
data in a computer so that it can be accessed and
worked with in an appropriate way. Pandas provides
and deals with the following data structures:

 Series: It is a one-dimensional structure storing


homogenous (same data type) mutable (which can
be modified ) data.

 Data Frames: It is a two-dimensional structure


storing heterogenous (multiple data type) mutable
(which can be modified)

Data Frames are most commonly used data


structure in pandas.
BASIC FEATURES OF DATAFRAMES
 Columns can be different data types i.e.; it is
possible to have any kind of data in columns.

 Size of Data Frame is mutable i.e., number of rows


and columns can be increased or decreased any
time.

 Its data/values are also mutable i.e., it can be


changed at any time.

 It has labelled axis (Named Rows and columns).

 Arithmetical operations are possible on rows and


columns.

 Indexes may constitute numbers, strings or letters.


DATA VISUALIZATION USING PYPLOT

Visualization is the easiest way to analyse and


absorb information.
Data visualization help us to easily understand a
complex problem and see certain patterns.
Data Visualization, basically refers to the graphical
or visual representation of information and data
using visual elements like charts , graphs , maps etc.

MATPLOTLIB

Matplotlib is a 2D plotting library that helps in


visualizing figures. Matplotlib is the most popular
plotting library used in Python as it is a robust, free
and easy library for data visualization and it is easy
to learn and understand. Matplotlib gives us control
over every aspect of a figure and it supports
interactive and non-interactive plotting and can save
images in several output formats, it is used to create
2D graphs and plots using Python scripts.

To import Matplotlib library:


Import matplotlib.pyplot as plt
CSV FILES

A Comma separated Values (CSV) file is a plain text


file that contains a list of data. These files are often
used for exchanging data between different
applications. These files may sometimes be called
Character Separated Values or Comma Delimited
files. They mostly use the comma character to
separate (or delimit) data, but sometimes use other
characters, like semicolons. The idea is that you can
export complex data from one application to a CSV
file, and then import the data in that CSV file into
another application.

Advantages of CSV format


 It is a simple and compact format for data storage.

 It has a common format for data interchange.

 It can be opened in popular spread sheet package


like Ms Excel, Calc etc.

 Nearly all spread sheets and databases support


import/export to csv data.
Two important functions of CSV/Excel file
 read_csv( ) : This function helps you to convert
data from a CSV file into a Data Frame.

 read_excel( ) : This function helps you to convert


data from a Excel file into a Data Frame.

HARDWARE AND SOFTWARE


SPECIFICATIONS

Hardware requirements:

Processor: INTEL 80386 COMPATIBLE OR


ABOVE
RAM: 4.0 MB
VDU: VGA / SVGA

Software requirements:

Operating System: WINDOWS NT, XP, VISTA ,7, 8

Python with Spyder Interface: version 3.7 with related


libraries used for Data Analysis

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

You might also like