Ip Project Class Xii
Ip Project Class Xii
PRACTICES
PROJECT CLASS XII
PROJECT ON
PRIME LAPTOPS
Name:
Ayaan Ashraf
Lahn Abdul Jaleel
Jerohn
Joshy
Reuben Varghese
Certificate
I, the undersigned, hereby certify
that the project entitled:
“Project on Prime Laptops”
submitted by
__________________________in part-
fulfilment of the internal examination
in Informatics Practices,(2024-25) is
a genuine work and has been
completed under my guidance and
supervision.
Acknowledgem
ent
I would like to express my sincere
gratitude to MR. PIUS MATHEW,
Head of the Department of Computer
Science & IP for his excellent
guidance, invaluable support and
encouragement. I would also like to
thank MRS. SMITHA JOHN,
Informatics Practices teacher for the
instructions given and tremendous
help.
Introduction to
Python
What is Python?
Python is a high-level, general-purpose
programming language. Its design
philosophy emphasizes code readability
with the use of significant indentation.
Its language constructs and object-
oriented approach aim to help
programmers write clear, logical code
for small- and large-scale projects.
Guido Van Rossum , a Dutch
Programmer developed Python
programming language in early 1990s.
He began working on Python in the late
1980s as a successor to the ABC
programming language and first
released it in 1991 as Python 0.9.0.[33]
Python 2.0 was released in 2000 and
introduced new features.
Python Library: Pandas
[PANEL DATA
SYSTEM]
It is the most famous Python package
for Data Science which offers powerful
and flexible data structures that make
data analysis and manipulation easy.
CSV File
Laptop Brand Model Proces RAM Storage Price Sales
_ID sor (GB) (GB) (INR) (Units)
LAP00 Dell Model- i3 8 256 45000 20
1 1
LAP00 HP Model- i5 16 512 60000 15
2 2
LAP00 Lenovo Model- i7 32 1024 80000 10
3 3
LAP00 Asus Model- Ryzen 3 8 512 55000 25
4 4
LAP00 Apple Model- Ryzen 5 16 256 75000 30
5 5
LAP00 Acer Model- Ryzen 7 32 1024 100000 5
6 6
LAP00 Dell Model- i3 8 256 45000 20
7 7
LAP00 HP Model- i5 16 512 60000 15
8 8
LAP00 Lenovo Model- i7 32 1024 80000 10
9 9
LAP01 Asus Model- Ryzen 3 8 512 55000 25
0 10
LAP01 Apple Model- Ryzen 5 16 256 75000 30
1 11
LAP01 Acer Model- Ryzen 7 32 1024 100000 5
2 12
LAP01 Dell Model- i3 8 256 45000 20
3 13
LAP01 HP Model- i5 16 512 60000 15
4 14
LAP01 Lenovo Model- i7 32 1024 80000 10
5 15
LAP01 Asus Model- Ryzen 3 8 512 55000 25
6 16
LAP01 Apple Model- Ryzen 5 16 256 75000 30
7 17
LAP01 Acer Model- Ryzen 7 32 1024 100000 5
8 18
LAP01 Dell Model- i3 8 256 45000 20
9 19
LAP02 HP Model- i5 16 512 60000 15
0 20
LAP02 Lenovo Model- i7 32 1024 80000 10
1 21
LAP02 Asus Model- Ryzen 3 8 512 55000 25
2 22
LAP02 Apple Model- Ryzen 5 16 256 75000 30
3 23
LAP02 Acer Model- Ryzen 7 32 1024 100000 5
4 24
LAP02 Dell Model- i3 8 256 45000 20
5 25
LAP02 HP Model- i5 16 512 60000 15
6 26
LAP02 Lenovo Model- i7 32 1024 80000 10
7 27
LAP02 Asus Model- Ryzen 3 8 512 55000 25
8 28
LAP02 Apple Model- Ryzen 5 16 256 75000 30
9 29
LAP03 Acer Model- Ryzen 7 32 1024 100000 5
0 30
Source Code
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df=pd.read_csv('Laptop.csv')
#histogram
sales=df.iloc[:,0]
price=df['Price (INR)']
def histogram():
plt.hist(sales,bins=len(sales),weights=pr
ice,edgecolor='green')
plt.title('Laptop sales of 2024')
plt.show()
#linechart
def linechart():
plt.plot(sales,price)
plt.title('Laptop sales of 2024')
plt.show()
#bar chart
def barchart():
index=np.arange(len(sales))
plt.bar(index,price)
plt.xlabel('Laptop sales', fontsize=10)
plt.ylabel('Price',fontsize=10)
plt.xticks(index,sales,fontsize=8,rotation
=35)
plt.title('Laptop sales of 2024')
plt.show()
def visual():
ch='y'
while ch=='y' or ch=='Y':
print()
print('-------------------------------------------------
----------------')
print(" ")
print("
Laptop Sales of Prime laptops in graphs
")
print(" ")
print('-------------------------------------------------
----------------')
print(" ")
print(" ")
print("1. Histogram")
print('2.Line Chart')
print('3.Bar Chart')
print('4.Go back to previous menu')
opt=input("Enter your choice in
numbers")
if opt=='1':
histogram()
elif opt=='2':
linechart()
elif opt=='3':
barchart()
elif opt=='4':
choice=input('are you sure you
want to exit [y/n]?')
if choice=='y' or choice=='Y':
print('Exiting and going back
to the previous menu.....')
break
else:
print('Invalid choice, please use
either 1,2,3 or 4 as your choice')
continue
else:
ch=input('are you sure you want to
exit [y/n]?')
def manip():
ch='y'
while ch=='y' or ch=='Y':
print()
print('-------------------------------------------------
-------------------------------------')
print(' ')
print(' Altering the
records of Prime Laptops')
print(' ')
print('-------------------------------------------------
-------------------------------------')
print(' ')
print(' ')
print('1.INSERT A ROW')
print('2.DELETE A ROW')
print('3.INSERT A COLUMN')
print('4.DELETE A COLUMN')
print('5.SEARCH FOR A BRAND')
print('6.UPDATE A RECORD')
print('7.GO BACK TO PREVIOUS
MENU')
opt1=input('Enter your choice:')
if opt1=='1':
lst=[]
print('Dataframe before inserting
a new row')
df=pd.read_csv('Laptop.csv')
print(df)
colname=df.columns
for k in range(len(colname)):
print(colname[k])
rowvalue=input(':')
lst.append(rowvalue)
df.loc[len(df)]=lst
df.to_csv('Laptop.csv',encoding='utf-
8',index=False,header=True)
print('dataframe after inserting a
new row')
print(df)
elif opt1=='2':
print(df)
i=int(input('Enter the brand of
laptop to be deleted to be deleted:'))
loc=df[(df.Laptop_ID==i)].index
df.drop(loc,inplace=True,axis=0)
df.to_csv('Laptop.csv',encoding='utf-
8',index=False,header=True)
print(df)
elif opt1=='3':
df=pd.read_csv('Laptop.csv')
print(df)
col=input('Enter the column
name:')
l=len(df)
lst=[]
for k in range(l):
colvalue=input('Enter the
value:')
lst.append(colvalue)
df[col]=pd.Series(lst)
df.to_csv('Laptop.csv',encoding='utf-
8',index=False,header=True)
print(df)
elif opt1=='4':
df=pd.read_csv('Laptop.csv')
print(df)
i=input('Enter the column to be
deleted:')
df.drop(i,inplace=True,axis=1)
df.to_csv('Laptop.csv',encoding='utf-
8',index=False,header=True)
print(df)
elif opt1=='5':
df=pd.read_csv('Laptop.csv')
print(df)
i = input('Enter the brand of the
laptop to be searched:')
print(df[df['Brand'].str.contains(i,
case=False, na=False)])
elif opt1=='6':
df=pd.read_csv('Laptop.csv')
print(df)
i=input('Enter the brand of the
Laptop to be updated')
#location = df [(df.iD==i)] index
print("Enter which has to be
updated")
c=df.columns
print('[',end='')
for k in c:
print(k,',',end='')
print("]")
col=input()
print("Enter the updated value
for",col)
new=input()
df.loc[df.Laptop_ID == i,col] =
new
df.to_csv('Laptop.csv',
encoding='utf-8',index=False,
header=True)
print("Updated DataFrame")
df=pd.read_csv('Laptop.csv')
print(df)
elif opt1=='7':
choice=input('are you sure you
want to exit [y/n]?')
if choice=='y' or choice=='Y':
print('Exiting and going back
to the previous menu.....')
break
else:
print('Invalid choice,Try again')
continue
else:
ch=input('Do you really want to exit
[y/n]?')
def read_csv_excel():
df=pd.read_csv('Laptop.csv')
ch='y'
while ch=='y' or ch=='Y':
print()
print('-------------------------------------------------
----------------')
print(" ")
print(" Reports
of Prime Laptop's sales ")
print(" ")
print('-------------------------------------------------
----------------')
print(" ")
print(" ")
print(" 1. Diplay the first n rows")
print(" 2. Diplay the last n rows")
print(" 3. Display the report after
sorting")
print(' 4. Display the number of
sales for each brand')
print(" 5. Go back to previous
menu")
opt=input("enter your choice in
numbers")
if opt=='1':
n=int(input("Enter the number of
rows to be displayed from the top:"))
print(df.head(n))
elif opt=='2':
n=int(input("enter the number or
rows to be displayed from the bottom"))
print(df.tail(n))
elif opt=='3':
SORT=input("enter the column in
which sorting needs to be done
[Laptop_ID/Brand/Model/Processor/RAM(
GB)/Storage(GB)/Price(INR)/Sales(Units)]
")
if SORT in df.columns:
print(df.sort_values(SORT))
else:
print("Invalid column name
choose one of these columns
[Laptop_ID/Brand/Model/Processor/RAM(
GB)/Storage(GB)/Price(INR)/Sales(Units)]
")
elif opt=='4':
print(df.groupby('Brand')['Sales
(Units)'].count())
elif opt=='5':
choice=input('are you sure you
want to exit [y/n]?')
if choice=='y' or choice=='Y':
print('Exiting and going back
to the previous menu.....')
break
else:
print('Invalid choice, please use
either 1,2,3 or 4 as your choice')
continue
else:
ch=input('are you sure you want to
exit [y/n]?')
ans='y'
while ans=='y' or ans=='Y':
print()
print('-------------------------------------------------
----------------')
print(" ")
print(" Project On
Prime laptops ")
print(" ")
print('-------------------------------------------------
----------------')
print(" ")
print(" ")
print("1. Laptop Sales of Prime laptops
in graphs")
print("2. Altering the records of Prime
Laptops")
print("3. Reports of Prime Laptop's
sales")
print("4. Exit")
opt=input("Enter your choice")
if opt=="1":
visual()
elif opt=="2":
manip()
elif opt=="3":
read_csv_excel()
elif opt=='4':
choice=input('are you sure you
want to exit [y/n]?')
if choice=='y' or choice=='Y':
print("Thank you. Exiting
now.......")
break
else:
print('Invalid choice, please use
either 1,2,3 or 4 as your choice')
continue
else:
ans=input('are you sure you want
to exit [y/n]?')
Output
Visualization
Bar Chart
Line Chart
Histogram
Manipulation
Login Page &Table
Conclusion
In conclusion, this python project
has been a highly insightful and
enriching experience. By applying
the theoretical concepts we
learned in class to real-world
coding tasks, we were able to
bridge the gap between abstract
principles and practical
implementation. The project
deepened our understanding of
key Python concepts.
Furthermore, it challenged us to
think critically and creatively,
improving our problem-solving
skills. Through debugging, testing
and refining our code, we gained
hands-on experience that
reinforced our learning and
allowed us to see how Python can
be used to solve complex
problems. Overall, this project
was a valuable learning
opportunity, enhancing both our
technical proficiency and our
ability to approach programming
challenges with confidence and
clarity.