0% found this document useful (0 votes)
437 views31 pages

Kunj Project 2

This document is a project report submitted by Kunj Bihari Saharma of class 12 for the subject Informatics Practices. The project involves using Python pandas to analyze data from a CSV file. It includes an introduction, objectives to analyze movie ticket data and book tickets online, descriptions of Python, pandas and CSV files, code snippets to perform tasks like reading data, adding rows, searching, sorting, and visualizing data. It aims to demonstrate skills in data analysis and manipulation using pandas and CSV files.

Uploaded by

kunj123sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
437 views31 pages

Kunj Project 2

This document is a project report submitted by Kunj Bihari Saharma of class 12 for the subject Informatics Practices. The project involves using Python pandas to analyze data from a CSV file. It includes an introduction, objectives to analyze movie ticket data and book tickets online, descriptions of Python, pandas and CSV files, code snippets to perform tasks like reading data, adding rows, searching, sorting, and visualizing data. It aims to demonstrate skills in data analysis and manipulation using pandas and CSV files.

Uploaded by

kunj123sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

A PROJECT WORK ON

INFORMATICS PRACTICES
(python pandas data frame with CSV)

SUBMITTED BY : kunj Bihari sahrma

Class: Xii d

ROLL NO:

1
N.R CONVENT SR SEC SCHOOL

ALL INDIA SENIOR SECONDARY CERTIFICATE EXAMINATION


(AISSCE-2023-24)
PROJECT REPORT OF PRACTICAL WORK IN

INFORMATICS PRACTICES(065)
NAME: KUNJ BIHARI SAHRMA

CLASS: XII - D

REG.NO: ................................................ YEAR: 2023-24


Certified that this is the bonafide project report of practical work

Sri/Kum.................................................................during the year 2023

PRINCIPAL TEACHER-IN-CHARGE

Date of Submission: EXTERNAL EXAMINER’S

(School Seal)

2
CONTENTS

1. ACKNOWLEDGEMENT

2. INTRODUCTION

3. ABOUT PYTHON PANDAS

4. OBJECTIVE OF THE PROJECT-DATA ANALYSIS

5. ABOUT CSV FILES

6. BASIC MODULES

7. CODES

8. OUTPUTS

9. DATA VISUALISATION

10.CONCLUSION

11.BIBLIOGRAPHY

3
ACKNOWLEDGEMENT

At the outset, we thank God almighty for making


this endeavour a great success.

We are also thankful to Sachin sir , our IP teacher


who has been the guide for our project and for the
timely guidance given.
Last but not the least we also express our
profound gratitude to all our well wishers who
assisted in various occasions during this project
work.

4
INTRODUCTION

This project is developed to provide the

customer’s anywhere, anytime service for booking

seat in movie hall. It is developed in such a way that

, it is best suited for its best functioning. In this

project we were able to do certain functions like

insert, update, view details, delete etc...This is

done with the help of our teacher and data being

transferred via code.

5
ABOUT PYTHON PANDAS

Python is an interpreted, high-level and general


purpose programming language. Created by Guido
van Rossum and first released in 1991, Python’s
design philosophy emphasizes code readability with
its notable use of significant whitespace. Its language
constructs and object-oriented approach aim to help
programmers write clear, logical code for small and
large-scale projects.
Python is dynamically typed and garbage
collected. It supports multiple programming
paradigms, including structured (particularly,
procedural), object-oriented, and functional
programming. Python is often described as a
“batteries included” language due to its
comprehensive standard library.
Pandas is a software library written for the Python
programming language for data manipulation and
analysis. In particular, it offers data structures and
operations for manipulating numerical tables and
time series. It is free software released under the
three-clause BSD license. The name is derived from
the term “panel data”, an econometrics term for data
sets that includes observations over multiple time
periods for the same individuals.

6
ABOUT CSV FILES

A comma-separated values (CSV) file is a


delimited text file that uses a comma to separate
values. Each line of the file is a data record. Each
record consists of one or more fields, separated by
commas. The use of the comma as a field separator
is the source of the name for this file format. A CSV
file typically stores tabular data (numbers and text)
in plain text, in which case each line will have the
same number of fields.

The CSV file format is not fully standardized.


The basic idea of separating fields with a comma is
clear, but that idea gets complicated when the field
data may also contain commas or even embedded

line breaks. CSV implementations may not


handle such field data, or they may use quotation
marks to surround the field. Quotation does not
solve everything: some fields may need embedded
quotation marks, so a CSV implementation may
include escape characters or escape sequences.

7
OBJECTIVE OF THE PROJECT

The project objective is to book cinema


tickets online. This online ticket reservation
system provides a website for booking cinema
ticket which can be accessed by any user who
have an internet connection. The website
provides complete information regarding
currently showing movies on all the screens with
details of show timings and also seats available.
My online ticket booking system is one of the best
opportunities for those who cannot afford enough
time to get their tickets reserved by standing in
long queues. People can book tickets at any time
day or night. We also have an option to cancel the
tickets which are reserved previously.

BASIC MODULES
8
• Create( ):It is a function used to enter the data containing
details.

• Add( ):It is function used to add details after the details has
been entered once.

• Display( ):It is function which is used to display all the


records entered into the system.

• Del( ):It is a function used to delete details of specified


names • Search( ):It is a function used to search the
details from the data

• Update( ):It is a function which is used to modify specific


information from the data.

• Table without header: Reading in a csv file into a Pandas Data


Frame will by default, set the first row of the .csv file as
the headers in the table. However, if the .csv file does not
have any pre-existing headers, Pandas can skip this step
and instead start reading the first row of the .csv as data
entries into the data frame.

• Head( ):returns the first n rows(observe the index values).


• Tail( ):returns the last n rows(observe the index values).

• Sorting the values in ascending order: It is used to sort the data


in ascending order on the basis of a specified column. •
Sorting the values in descending order: It is used to sort the
data in descending order on the basis of a specified
column.

9
CODES

10
import pandas as pd
import os
import matplotlib.pyplot as plt
d={'tno':['A1','B2','C3'],
'tname':['Marakkar','No Time To Die','Minnal Murali'],
'tprice':[100,200,300],
'screen':[1,2,1],
'genre':['Thriller','Action','Sci-Fiction']}
df=pd.DataFrame(d)
print('Ticket Information :')
print(df)
df.to_csv('tinfo.csv')
df=pd.read_csv('tinfo.csv')
print(df)
print('Menus available:')
print('1.Add a new row:')
print('2.search a row:' )
print('3.update a row:')
print('4.Delete a row:')
print('5.Table without header:')
print('6.Table without index:')
print('7.Read the CSV file with new column names:')
print('8.Access the values using head()function:')
print('9.Access the values using tail()function:')
print('10.Sorting in ascending order:')
print('11.Sorting in descending order:')
print('12.To display of Movie Ticket where price is greater than 10
0:')
print('13.Changing the existing values into nan:')
print('14.Delete values using index:')
print('Data Visualisation:')
print('15.Bar Graph:')
print('16.Line Graph:')
print('17.Histogram:')
c='y'
while c=='y':
ch=eval(input('Enter your choice:'))
if ch==1:
t=(input('Enter ticket no:'))
tn=input('Enter the ticket name:')
p=int(input('Enter the price:'))
sc=int(input('Enter the screen:'))
g=input('Enter the genre:')

11
data={'tno':t, 'tname':tn, 'tprice':p, 'screen':sc, 'genre':g}
df=df.append(data,ignore_index=True)
df.to_csv('tinfo.csv')
print(df)
elif ch==2:
n=input('Enter the ticketno:')
df=pd.read_csv('tinfo.csv')
s=df[df['tno']==n]
print(s)
elif ch==3:
N=input('Enter the ticket no:')
df=pd.read_csv('tinfo.csv')
x=df[df['tno']==N].index
Pr=int(input('Enter the new price:'))
df.at[x,'tprice']=Pr
df.to_csv('temp.csv', index=True)
os.remove('tinfo.csv')
os.rename('temp.csv', 'tinfo.csv')
print(df)
elif ch==4:
D=pd.read_csv('tinfo.csv')
bk=D.tname.to_list()
print(bk)
a=input('Enter the tname you want to delete:')
if a in bk:
d1=D.drop(df[df.tname==a].index)
d1.to_csv('temp.csv',index=False)
os.remove('tinfo.csv')
os.rename('temp.csv', 'tinfo.csv')
print(d1)
else:
print('Not')
elif ch==5:
df=pd.read_csv('tinfo.csv', header=None)
print('Table without header:')
print(df)
elif ch==6:
df=pd.read_csv('tinfo.csv', index_col=0)
print('Table without index:')
print(df)
elif ch==7:
l=[]
for i in range(5):

12
nn=input('Enter the new column names:')
l.append(nn)
df=pd.read_csv('tinfo.csv', skiprows=1,names=l)
print('Table with new column names:')
print(df)
elif ch==8:
n=eval(input('No:of values to be selected:'))
print('The first',n,'values are:' )
print(df.head(n))
elif ch==9:
n=eval(input('No:of values to be selected:'))
print('The last',n,'values are:')
print(df.tail(n))
elif ch==10:
cn=input('Enter the column name:')
print('The table sorted in ascending order of',cn,':')
print(df.sort_values(by=[cn]))
elif ch==11:
cn=input('Enter the column name:')
print('The table sorted in descending order of', cn,':')
print(df.sort_values(by=[cn],ascending =False))
elif ch==12:
df=pd.read_csv('tinfo.csv')
df1=df.loc[df['tprice']>100]
print(df1)
elif ch==13:
n=eval(input('Enter the no:of values to be changed to nan:'))
l=[]
for i in range(n):
val=int(input('Enter the values to be changed:'))
l.append(val)
df=pd.read_csv('tinfo.csv',na_values=l)
print(df)
elif ch==14:
n=eval(input('Enter the no:of indices to be removed:'))
l=[]
for i in range(n):
val=int(input('Enter the index to be removed :'))
l.append(val)
print('Values after removed:')
print(df.drop(l))
elif ch==15:
x=['Marakkar','No Time To Die','Minnal Murali']

13
y=[100,200,300]
plt.bar(x,y,color='b')
plt.xlabel('Movie')
plt.ylabel('price')
plt.title('Bar Graph')
plt.show()
elif ch==16:
x=['Marakkar','No Time To Die','Minnal Murali']
y=[100,200,300]
plt.xlabel('Movie')
plt.ylabel('price')
plt.plot(x,y,'*r',linestyle='dotted')
plt.title('Line Chart')
plt.show()
elif ch==17:
x=['Marakkar','No Time To Die','Minnal Murali']
y=[100,200,300]
plt.hist(x,bins=7,color='red')
plt.xlabel('price')
plt.ylabel('bins')
plt.title('Histogram')
plt.show()
else:
print('invalid input')
c=input('Do you want to continue(y/n:’)

14
OUTPUT

15
Ticket Information :
tno tname tprice screen genre
0 A1 Marakkar 100 1 Thriller
1 B2 No Time To Die 200 2 Action
2 C3 Minnal Murali 300 1 Sci-Fiction
Unnamed: 0 tno tname tprice screen genre
0 0 A1 Marakkar 100 1 Thriller
1 1 B2 No Time To Die 200 2 Action
2 2 C3 Minnal Murali 300 1 Sci-Fiction
Menus available:
1.Add a new row:
2.search a row:
3.update a row:
4.Delete a row:
5.Table without header:
6.Table without index:
7.Read the CSV file with new column names:
8.Access the values using head()function:
9.Access the values using tail()function:
10.Sorting in ascending order:
11.Sorting in descending order:
12.To display of Movie Ticket where price is greater than 100:
13.Changing the existing values into nan:
Enter your choice:1
Enter ticket no:D4
Enter the ticket name:Shershaah
Enter the price:400
Enter the screen:2
Enter the genre:Drama
Unnamed: 0 tno tname tprice screen genre
0 0.0 A1 Marakkar 100 1 Romance

16
1 1.0 B2 No time to Die 200 2 Thriller
2 2.0 C3 Minnal Murali 300 1 Action
3 NaN D4 Shershaah 400 2 Drama
2
Enter your choice:2
Enter the ticketno:C3
Unnamed: 0 Unnamed: 0.1 tno tname tprice screen genre
2 2 2.0 C3 Minnal Murali 300 1 Action
Do you want to continue (y/n):
3

17
Enter your choice:3
Enter the ticket no:D4
Enter the new price:450
Unnamed: 0 Unnamed: 0.1 tno tname tprice screen genre
0 0 0.0 A1 Marakkar 100 1 Romance
1 1 1.0 B2 No time to Die 200 2 Thriller
2 2 2.0 C3 Minnal Murali 300 1 Action
3 3 NaN D4 Shershaah 450 2 Drama
Do you want to continue (y/n):
4
Enter your choice:4

18
['Marakkar', 'No time to Die', 'Minnal Murali']
Enter the tname you want to delete:Marakkar
Unnamed: 0 Unnamed: 0.1 Unnamed: 0.1.1 ...
tprice screen genre
1 1 1 1.0 ... 200 2 Thriller
2 2 2 2.0 ... 300 1 Action
[2 rows x 8 columns]
Do you want to continue (y/n)
5
Enter your choice:5
Table without header:
•012345

0 NaN tno tname tprice screen genre


1 0.0 A1 Marakkar 100 1 Romance
2 1.0 B2 No time to Die 200 2 Thriller
3 2.0 C3 Minnal Murali 300 1 Action
Do you want to continue (y/n):

19
6
Enter your choice:6
Table without index:
tno tname tprice screen genre
0 A1 Marakkar 100 1 Romance
1 B2 No time to Die 200 2 Thriller
2 C3 Minnal Murali 300 1 Action
Do you want to continue (y/n):
Enter your choice:7
Enter the new column names:1
Table with new column names:
1
0 A1 Marakkar 100 1 Romance
1 B2 No time to Die 200 2 Thriller
2 C3 Minnal Murali 300 1 Action
Enter your choice:8

20
No:of values to be selected:2
The first 2 values are:
Unnamed: 0 tno tname tprice screen genre
0 0 A1 Marakkar 100 1 Romance
1 1 B2 No time to Die 200 2 Thriller
Do you want to continue (y/n):
Enter your choice:9
No:of values to be selected:3
The last 3 values are:
Unnamed: 0 tno tname tprice screen genre
0 0 A1 Marakkar 100 1 Romance
1 1 B2 No time to Die 200 2 Thriller
2 2 C3 Minnal Murali 300 1 Action
Do you want to continue (y/n):
Enter your choice:10
Enter the column name:tno
The table sorted in ascending order of tno :
Unnamed: 0 tno tname tprice screen genre

21
0 0 A1 Marakkar 100 1 Romance
1 1 B2 No time to Die 200 2 Thriller
2 2 C3 Minnal Murali 300 1 Action
Do you want to continue (y/n):
Enter your choice:11
Enter the column name:tno
The table sorted in descending order of tno :
Unnamed: 0 tno tname tprice screen genre
2 2 C3 Minnal Murali 300 1 Action
1 1 B2 No time to Die 200 2 Thriller
0 0 A1 Marakkar 100 1 Romance
Do you want to continue (y/n):
Enter your choice:12
Unnamed: 0 tno tname tprice screen genre
1 1 B2 No time to Die 200 2 Thriller

22
2 2 C3 Minnal Murali 300 1 Action
Do you want to continue (y/n):
Enter your choice:13
Enter the no:of values to be changed to nan:2
Enter the values to be changed:100
Unnamed: 0 tno tname tprice screen genre
0 0 A1 Marakkar NaN 1 Romance
1 1 B2 No time to Die 200.0 2 Thriller
2 2 C3 Minnal Murali 300.0 1 Action
Enter the values to be changed:
Enter your choice:14
Enter the no:of indices to be removed:1
Enter the index to be removed :1
Values after removed:
Unnamed: 0 tno tname tprice screen genre
0 0 A1 Marakkar 100 1 Romance
2 2 C3 Minnal Murali 300 1 Action

23
DATA VISUALISATION
We all Know that images or visuals are we sure
are powerful for most communication . We often
use them to understand a situation better or to
condense pieces of information into a graphical
representation.

Visualization is the easiest to analyse and


absolute information. It is the first step for any kind
Of that analysis this work we shall serve better cold
data visualization help us to easily understand
their complex problem I see certain patterns. Data
visualization techniques are grained popularity.
Data visualization basically refers to graphical or
visual representation of information and data using
we shall elements like chart graph map etc. Data
visualization in Python can done by remaining
packages. one example of package is matplotlib.
Matplotlib Package can be used in Python script,
web applications post up invite and we can use two
exclusive libraries for

visualization, commonly known as matplotlib and


seaborn.

24
BAR GRAPH:-

It is a pictorial representation of data. That uses


bars to compare different categories of data.
Comparison of discrete variables.

LINE CHART:-

A line plot/chart is a graph that shows the


frequency of data occurring along a number line.
The line plot is represented by a series of data points
connected with a straight line. Generally line plots
are used to display trends over time. A line plot or
line graph can be created using the plot() function
available in pyplot library.

HISTOGRAM:-

It is refers to graphical representation, that


displays data in the way of bars to show the
frequency of Numerical data. Indicates
distribution of non discrete variables

25
OUTPUT

26
27
28
CONCLUSION

This project has been developed successfully


and the performance of the system has been found
satisfactory. This project is basically made for
providing the customer anytime and anywhere
service for booking cinema tickets and providing
information about the movies and their schedule
via online, which saves the time and effort of
movie lovers.

29
BIBLIOGRAPHY

• Informatics Practices for class XII


-by SUMITH ARORA/PREETI ARORA

➢ https://www.python.org/

➢ https://www.learnpython.org/

➢ https://www.research,org/

30
1

You might also like