Professional Documents
Culture Documents
Ip Grade 12 Project 2021-2022
Ip Grade 12 Project 2021-2022
By
Akshay Kalgikar, Mohammed Ayan
and Vibin Gopikrishnan
1
BRIGHT RIDERS SCHOOL
PROJECT REPORT 2021-22
CERTIFICATE
Certified that this is the bonafide record of the Project Work titled
____________________________________________________________
Done by
Name :
Roll Number :
Admission Number :
Class : XII Sci. During the year 2021-22
________________________
Teacher in Charge
(Informatics Practices Department)
______________ ____________
Examiner Principal
2
INDEX
SR.NO CONTENT PG.NO
1 ACKNOWLEDGMENT 4
2 SYSTEM 5
REQUIREMENT
3 PROJECT ABSTRACT 6
4 THEORITICAL 7-9
BACKGROUND
5 DATABASE DESIGN 10
6 CODING 11-27
7 OUTPUT 28-40
8 BIBLIOGRAPHY 41
3
Acknowledgement
I am using this opportunity to express my gratitude to
everyone who supported me throughout this project.
First of all, I would like to thank the almighty for always
being with me. I would like to express my sincere
gratitude to my dear teacher, Ms. Deepa Shanmugham
For her vital support, guidance, and encouragement
without which this project would have not have come
forth. I thank my principal, Dr. Rishikesh Padegaonkar
for his support and for providing me with the facility to
complete my project.
I would also thank my parents and my friends and
fellow group members who have shown constant
support. This assignment has given me an opportunity
to research in various fields of the subject which has
boosted my knowledge and overall understanding of it
as well.
4
SYSTEM REQUIREMENT
HARDWARE REQUIREMENTS
SOFTWARE REQUIREMENTS
1. SOFTWARE SPECIFICATIONS
USED
2. Operating system WINDOWS 10
used
5
PROJECT ABSTRACT
The car dealership management system refers to a data
management system that allows the user to store information that
you would find stored in the record of a car dealership in a more
simple, cost efficient and digital manner. The car dealership
management system helps to create and maintain up-to-date
information regarding the car in the dealership on details such as its
sales status, ownership status, price, series no, vehicle type, etc and
other details to know about the vehicle stored in the dealership. It
contains all the info regarding a car and allows us to keep the info
updated and due to its simple interface it can be used by any staff
members who may or may not have experience with computers to
conveniently manipulate, update or delete information regarding the
vehicle in the data provided in the system. There are also other
various fields that are present that make it convenient for the person
who is accessing the data such as graphs and data analysis means
that make it easier for the people operating it to understand and
perceive the data in a simple and straight forward means.
6
THEORITICAL BACKGROUND
PYTHON – FRONT END
What is Python?
Python is a popular programming language. It was created by Guido van
Rossum, and released in 1991.
It is used for:
Why Python?
• Python works on different platforms (Windows, Mac, Linux, Raspberry
Pi, etc).
• Python has a simple syntax similar to the English language.
• Python has syntax that allows developers to write programs with fewer
lines than some other programming languages.
• Python runs on an interpreter system, meaning that code can be
executed as soon as it is written. This means that prototyping can be
very quick.
• Python can be treated in a procedural way, an object-orientated way or
a functional way.
7
• In this tutorial Python will be written in a text editor. It is possible to
write Python in an Integrated Development Environment, such as
Thonny, Pycharm, Netbeans or Eclipse which are particularly useful
when managing larger collections of Python files
MySQL Features
• Relational Database Management System (RDBMS) MySQL is a relational
database management system. ...
• Easy to use. MySQL is easy to use. ...
• It is secure. MySQL consists of a solid data security layer that protects sensitive
data from intruders. ...
• Client/ Server Architecture.
• Free to download.
• It is scalable.
• Speed.
• High Flexibility.
What is SQL?
• SQL stands for Structured Query Language
• SQL lets you access and manipulate databases
• SQL became a standard of the American National Standards Institute
(ANSI) in 1986, and of the International Organization for Standardization
(ISO) in 1987
8
What Can SQL do?
• SQL can execute queries against a database
• SQL can retrieve data from a database
• SQL can insert records in a database
• SQL can update records in a database
• SQL can delete records from a database
• SQL can create new databases
• SQL can create new tables in a database
• SQL can create stored procedures in a database
• SQL can create views in a database
• SQL can set permissions on tables, procedures, and views
RDBMS
RDBMS stands for Relational Database Management System.
RDBMS is the basis for SQL, and for all modern database systems such as MS
SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
9
DATABASE DESIGN
10
CODING
Main Menu
import mysql.connector
import pandas as pd
import menu1
import menu2
import menu3
import menu4
import menu5
print("""
------------------------------------------------------
|===================================================
===|
|======== *****MAIN MENU*****========|
|===================================================
===|
------------------------------------------------------
11
Enter 1 : EDIT MYSQL TABLE FROM PYTHON
Enter 2 : CREATE DATAFRAME FROM MYSQL TABLE
Enter 3 : CREATE DATAFRAME FROM CSV FILE
Enter 4 : DATAFRAME ANALYSIS
Enter 5 : GRAPHICAL ANALYSIS
Enter 6 : EXIT PROGRAM
""")
while(True):
ch=int(input("Enter your choice from the main menu:"))
if(ch==1):
print("call the function for manipulation")
menu1.manipulation()
if(ch==2):
print("call the function for creation of df from table")
menu2.mysqltodf()
if(ch==3):
print("call the function for creation of df from csv")
menu3.csvtodf()
if(ch==4):
print("call the function for df analysis")
menu4.csvtodef()
if(ch==5):
print("call the function for graph generation")
menu5.graphGenAnalysis()
if(ch==6):
print("exit from the application")
break
12
Menu 1
def manipulation():
import mysql.connector
print("""
------------------------------------------------------
|===================================================
===|
|==============MANIPULATION OF RECORD ===============|
|===================================================
===|
------------------------------------------------------
mydb=mysql.connector.connect(host="localhost",user="root",passwd="brightriders2
020#")
mycursor=mydb.cursor()
mycursor.execute("create database if not exists project")
mycursor.execute("use project")
#creating required tables
13
mycursor.execute("create table if not exists VEHICLES(serial_no
INT(4),model_name varchar(50), model_year int(4), vehicle_type varchar(35),
sales_status varchar(20), manufactured_in varchar(20), ownership_history
varchar(20), last_maintenance varchar(10))")
mydb.commit()
while(True):
opt=int(input("ENTER YOUR OPTION:"))
if (opt==1):
print()
serial_no=int(input("ENTER SERIAL NUMBER OF THE VEHICLE:"))
print("""
""")
model_name=str(input("ENTER MODEL NAME:"))
print("""
""")
model_year=int(input("ENTER THE MODEL YEAR:"))
print("""
""")
vehicle_type=str(input("ENTER VEHICLE TYPE:"))
print("""
""")
sales_status=str(input("ENTER SALE STATUS:"))
print("""
""")
manufactured_in=str(input("ENTER COUNTRY OF MANUFACTURE:"))
print("""
""")
ownership_history=str(input("ENTER OWNERSHIP HISTORY:"))
print("""
""")
14
last_maintenance=str(input("ENTER LAST MAINTENANCE DATE:"))
print("""
""")
sql="INSERT INTO VEHICLES(serial_no, model_name, model_year,
vehicle_type, sales_status, manufactured_in, ownership_history, last_maintenance)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s)"
val=(serial_no, model_name, model_year, vehicle_type, sales_status,
manufactured_in, ownership_history, last_maintenance)
mycursor.execute(sql,val)
mydb.commit()
print("DATA ENTERED INTO SQL RECORD SUCCESSFULLY")
print("-------------------------------------------------------------------------------------
-------------------------")
continue
if (opt==2):
print()
mycursor.execute("select * from vehicles")
for i in mycursor:
print(i)
print("THE INFORMATION HAS BEEN SUCCESSFULLY DISPLAYED")
print("-------------------------------------------------------------------------------------
-------------------------")
continue
if (opt==3):
print("DATA BEFORE DELETION")
mycursor.execute("select * from vehicles")
for i in mycursor:
print(i)
serial_no=int(input("ENTER THE SERIAL NUMBER WHOSE DATA MUST BE
DELETED:"))
sql="delete from VEHICLES where serial_no=%s"
15
#print(sql)
val=(serial_no,)
#print(val)
mycursor.execute(sql,val)
mydb.commit()
print("DATA DELETED SUCCESSFULLY")
print("TABLE AFTER DELETION")
mycursor.execute("select * from VEHICLES")
for i in mycursor:
print(i)
continue
if (opt==4):
print("""
""")
print("TABLE BEFORE UPDATE")
mycursor.execute("select * from VEHICLES")
for i in mycursor:
print(i)
print("""
""")
serial_no=int(input("ENTER THE SERIAL NUMBER FOR THE UPDATE:"))
sales_status=str(input(("ENTER THE NEW SALES STATUS OF THE
VEHICLE:")))
sql="update vehicles set sales_status=%s where serial_no=%s"
val=(sales_status,serial_no)
mycursor.execute(sql,val)
mydb.commit()
print("""
16
""")
print("DATA UPDATED SUCCESSFULLY!")
print("TABLE AFTER UPDATE")
mycursor.execute("select * from vehicles")
for i in mycursor:
print(i)
serial_no=input("PLEASE ENTER THE SERIAL NUMBER OF THE VEHICLE TO
VIEW THE DETAILS:")
mycursor.execute("select * from vehicles where serial_no="+serial_no)
for i in mycursor:
print(i)
continue
if (opt==5):
print()
mycursor.execute("select * from vehicles")
for i in mycursor:
print(i)
print("""
""")
serial_no=str(input("ENTER THE SERIAL NUMBER OF THE VEHICLE VIEW
THE DETAILS:"))
mycursor.execute("select * from vehicles where serial_no="+serial_no)
for i in mycursor:
print(i)
continue
17
if (opt==6):
print("****ALTER MENU****")
print("1. Add Column")
print("2. Drop Column")
print("3. Exit Menu")
while(True):
ch=int(input("CHOOSE AN OPTION FOR ALTER MENU:"))
if (ch==1):
print("TABLE BEFORE ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i)
print("""
""")
COLUMN_NAME=input("ENTER THE COLUMN NAME:")
DATATYPE=input("ENTER DATATYPE:")
mycursor.execute("alter table vehicles add "+COLUMN_NAME+" "
+DATATYPE)
mydb.commit()
print("TABLE AFTER ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i)
continue
if (ch==2):
print("TABLE BEFORE ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i)
print("""
""")
18
COLUMN_NAME=input("ENTER NAME OF COLUMN TO BE DELETED:")
mycursor.execute("alter table vehicles drop " +COLUMN_NAME)
mydb.commit()
print("TABLE AFTER ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i)
continue
if (ch==3):
print("Exiting to previous menu...")
break
if (opt==7):
print("PROGRAM CLOSED")
break
19
Menu 2
def mysqltodf():
import pandas as pd
import sqlalchemy as sq
import mysql.connector
print("""
-------------------------------------------------------------------
|===================================================
================|
|======== IMPORTING FROM MYSQL TO DF =========|
|===================================================
================|
--------------------------------------------------------------------
mydb=mysql.connector.connect(host="localhost",user="root",passwd="brightriders2
020#")
20
con=sq.create_engine("mysql+pymysql://root:brightriders2020#@localhost/project"
)
df=pd.read_sql_query('SELECT * FROM vehicles',con)
print(df)
print("Successfully importing the data")
continue
if(ch==2):
print("CLOSING PROGRAM...")
break
Menu 3
def csvtodf():
import pandas as pd
df=pd.read_csv("car.csv")
print("----------------EXTRACTING DATA FROM CSV----------------")
print(df)
print("DATAFRAME CREATED SUCCESSFULLY")
Menu4
def csvtodef():
import pandas as pd
import sqlalchemy as sq
import mysql.connector
df=pd.read_csv("car.csv")
print("""
21
Enter 4 : Grouping Vehicles Based on Sales Status
Enter 5 : Grouping Vehicles Based on Ownership History
Enter 6 : Exit the Program""")
while(True):
ch=int(input("Enter your choice:"))
if(ch==1):
23
sql="select * from vehicles where ownership_history='second hand'"
mycursor.execute(sql)
for i in mycursor:
print(i)
mydb.commit()
continue
if (opt==2):
mydb=mysql.connector.connect(host="localhost", user="root",
passwd="brightriders2020#")
mycursor=mydb.cursor()
mycursor.execute("use project")
sql="select * from vehicles where ownership_history='pre owned'"
mycursor.execute(sql)
for i in mycursor:
print(i)
mydb.commit()
continue
if (opt==3):
print("Redirecting to Main Menu...")
break
if(ch==7):
print("EXITING THE PROGRAM")
break
Menu 5
def graphGenAnalysis():
import pandas as pd
import mysql.connector
import matplotlib.pyplot as plt
24
import numpy as np
while(True):
print("option 1:Bar chart")
print("option 2:Pie chart")
print("option 3:Line chart")
print("option 4:Descriptive statistics")
print("option 5:Horizontal Bar graph")
print("option 6:Histogram")
print("option 7:exit")
ch=int(input("Enter your choice:"))
if ch==1:
df=pd.read_csv("car.csv")
df3=df.groupby(['vehicle_type']).count()
print(df3)
df3.plot(kind='bar',y=df3.price.count(),color=["blue","green","yellow","red"])
plt.title('Car Dealership')
plt.xlabel("Model Name")
plt.ylabel("Sales Status")
plt.show()
elif ch==2:
df=pd.read_csv("car.csv")
df3=df.groupby(['manufactured_in']).count()
y=df3['price'].tolist()
carlabels=["CANADA","JAPAN","INDIA", "USA"]
plt.pie(y,autopct="%1.2f%%", labels=carlabels )
plt.legend()
plt.title("PIE CHART - VEHICLES MANUFACTURED IN EACH COUNTRY")
plt.show()
elif ch==3:
25
df=pd.read_csv("car.csv")
dfline=df.groupby('sales_status').count()
print(dfline)
y=dfline['price'].tolist()
print(y)
x=['booked','for sale','out of stock']
print(x)
print(y)
plt.plot(x,y,color="Blue",linestyle="dotted",marker="s",markersize=6,markeredgecol
or="red")
'''dfline.plot(kind="line",y=dfline.sales_status.count(),color="Blue",linestyle="dotted"
,
marker="s",markersize=6,markeredgecolor="red")'''
plt.title("Number of cars per sales status")
plt.xlabel("sales_status")
plt.ylabel("Number of cars")
plt.show()
elif ch==4:
df=pd.read_csv("car.csv")
res=df["price"].describe()
print(df)
plt.plot(res.index,res.values,color="m",marker="o",markersize=6,markeredgecolor=
"blue")
plt.title("Descriptive statistics for Price")
plt.show()
elif ch==5:
df=pd.read_csv("car.csv")
df4=df.groupby(['vehicle_type'])
c=pd.DataFrame([df4['price'].sum()])
26
c.plot(kind='barh')
plt.title("Horizontal Bar graph Price in each Vehicle Type")
plt.show()
elif ch==6:
df=pd.read_csv("car.csv")
data1=list(df.vehicle_type)
plt.hist(data1,bins=6,histtype="barstacked",align="mid",color="yellow",edgecolor="
m")
plt.title('Histogram - List of Vehicle Types')
plt.ylabel('Frequency of Vehicle Type')
plt.xlabel('Vehicle Type')
plt.show()
elif ch==7:
break
else:
print("Invalid Choice")
continue
27
OUTPUT :
Main menu
28
Menu 1
29
30
31
Menu 2
32
Menu 3
Menu 4
33
34
35
Menu 5
36
37
38
39
40
BIBLIOGRAPHY
Sumita arora textbook class 12
http://python.mykvs.in/index.php
NCERT IP textbook
https://python4csip.com
41