Class 12 - IP - Practical File - Finalised
Class 12 - IP - Practical File - Finalised
(SENIOR SECONDARY)
REG. NO : __________________________________
( Senior Secondary School )
( Affiliation to CBSE, New Delhi - No : 1930564 )
Kurunji Nagar , Chinnakallupalli Village , Vaniyambadi Taluk – 635751
Tirupattur District , Tamil Nadu
CERTIFICATE
This is to certify that Mas. / Miss ………………………………………………
Data Visualisation
Aim :
To Find the Sum of the values which are ending with 3 or 5
Code :
import pandas as pd
list = [33,55,65,29,19,23]
ser = pd.Series(list)
val_sum=0
sum5=sum(ser[ser%10==5])
sum3=sum(ser[ser%10==3])
print ( sum3+sum5)
Output :
176
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
1
Date : 07.07.23
Aim :
To create a series of 10 numbers starting with 41 and ending with 71 with the increment
of 3 . Add 7 to odd values and subtract 3 for even values .
Code :
import pandas as pd
ser=pd.Series(range(41,71,3))
for i in range (0,ser.size);
if ser[i]%2==0;
ser[i]=ser[i]-3
elif ser[i]%2!=0;
ser[i]=ser[i]+7
print(ser)
Output :
0 48
1 41
2 54
3 47
4 60
5 53
6 66
7 59
8 72
9 65
dtype : int64
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
2
Date : 11.07.23
Ex. No : 3 CHANGING VALUES OF ALL ELEMENTS WHOSE VALUES ARE
MULTIPLE OF 4
Aim :
To create a series of 10 numbers . Change the value of all elements those values are
multiples of 4 .
Code :
import pandas as pd
numbers[ ]
for i in range (1,11);
val=int(input(“Enter a number : ”))
numbers.append(val)
ser=pd.Series(numbers)
ser[ser%4==0] = 21
print(ser)
Output :
Enter a number : 20
Enter a number : 12
Enter a number : 13
Enter a number : 14
Enter a number : 16
Enter a number : 18
Enter a number : 24
Enter a number : 48
Enter a number : 25
Enter a number : 26
0 21
1 21
2 13
3 14
4 21
5 18
6 21
7 21
8 25
9 26
dtype : int64
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
3
Date : 14.07.23
Ex. No : 4 PRINTING TOP 3 ELEMENTS USING HEAD FUNCTION
Aim :
To create a series and print the top 3 elements using the head function
Code :
import pandas as pd
ser_length = int(input(“Enter the length of the series : ”)
data = [ ]
for i in range(ser_length);
val=int(input(“Enter a val : ”))
data.append(val)
ser = pd.Series(data)
print(ser.head(3))
Output :
Enter the length of the series : 5
Enter a val : 11
Enter a val : 20
Enter a val : 55
Enter a val : 23
Enter a val : 65
0 11
1 20
2 55
dtype : int64
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
4
Date : 18.07.23
Aim :
To create a series and print the bottom 3 elements using the tailfunction
Code :
import pandas as pd
ser_length = int(input(“Enter the length of the series : ”)
data = [ ]
for i in range(ser_length);
val=int(input(“Enter a val : ”))
data.append(val)
ser = pd.Series(data)
print(ser.tail(3))
Output :
Enter the length of the series : 5
Enter a val : 21
Enter a val : 25
Enter a val : 63
Enter a val : 85
Enter a val : 74
2 63
3 85
4 74
dtype : int64
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
5
Date : 21.07.23
Aim :
To create a series with values , exchange all these values by shifting each of them
one position before
Code :
import pandas as pd
import numpy as np
s=pd.Series([21,51,71,31,12])
print(pd.Series(np.roll(s.values, - 1), index = s.index))
Output :
0 51
1 71
2 31
3 12
4 21
dtype : int64
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
6
Date : 25.07.23
Ex. No : 7 CREATING DATAFRAME USING LIST
Aim :
To create a dataframe named students using list of names of 5 students.
Code :
import pandas as pd
students=[“Ram”,”Aman”,”Akash”,”Ramesh”,”Virat”]
students=pd.DataFrame(students,columns=[“Name”])
print(students)
Output :
Name
0 Ram
1 Aman
2 Akash
3 Ramesh
4 Virat
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
7
Date : 28.07.23
Ex. No : 8 CREATING DATAFRAME USING NESTED LIST
Aim :
To create a dataframeplayers usinga list of names and scores of previous three matches
( using Nested List )
Code :
import pandas as pd
data = [[“Virat”,55,66,31],[“Rohit”,88,66,43],[“Dhoni”,99,85,68]]
players = pd.DataFrame(data,columns=[“Name”,“M1”,“M2”,“M3”])
print(players)
Output :
Name M1 M2 M3
0 Virat 55 66 31
1 Rohit 88 66 43
2 Dhoni 99 85 68
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
8
Date : 07.08.23
Ex. No : 9 CREATING DATAFRAME USING DICTIONARY
Aim :
To create a dataframecountries using dictionary which stored country name, capitals
and population of the country .
Code :
import pandas as pd
country_data = {“Country Name”:[“India”, “Canada”, “Australia”],
“Capital”:[“New Delhi” , “Ottawa”, “Canberra”],
“Population” : [“136 Cr”, “10 Cr”, “50 Cr”]}
countries = pd.DataFrame(country_data)
print(countries)
Output :
CoutryName Capital Population
0 India New Delhi 136 Cr
1 Canada Ottawa 10 Cr
2 Australia Canberra 50 Cr
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
9
Date : 11.08.23
Ex. No : 10 ITERATE DATAFRAME BY ITS ROWS , USING LIST
Aim :
To iterate the dataframe by its rows , using a list of names
Code :
import pandas as pd
data = [[“Virat”,55,66,31],[“Rohit”,88,66,43],[“Dhoni”,99,85,68]]
players = pd.DataFrame(data,columns=[“Name”,“Match1”,“Match 2”,“Match 3”])
for index,row in players.iterrows():
print(index,row.values)
Output :
0 [“Virat” 55 66 31]
1 [“Rohit” 88 66 43]
2 [“Dhoni” 99 85 68]
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
10
Date : 16.08.23
Ex. No : 11 ITERARTING THE DATAFTRAME USING ITERROWS
Aim :
To print scores of previous two matches along with their names using iterrows
function
Code :
import pandas as pd
data = [[“Virat”,55,66,31],[“Rohit”,88,66,43],[“Dhoni”,99,85,68]]
players = pd.DataFrame(data,columns=[“Name”,“Match 1”,“Match 2”,“Match 3”])
for index,row in players.iterrows():
print(index,row[“Name”],row[“Match 2”],row[“Match 3”])
print(players)
Output :
0 Virat 66 31
1 Rohit 66 43
2 Dhoni 85 68
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
11
Date : 19.08.23
Ex. No : 12 DISPLAYING DATA WITH RANK USING DATAFRAME
Aim :
To create dataframe players and display their rank according to their scores
Code :
import pandas as pd
data = [[“Virat”,55,66,31],[“Rohit”,88,66,43],[“Dhoni”,99,85,68]]
players = pd.DataFrame(data,columns=[“Name”,“Match 1”,“Match 2”,“Match 3”])
players[“Total_score”] = players[“Match 1”] + players[“Match 2”]+players[“Match 3”]
players[“Rank”] = players[“Total_score”].rank(ascending=0)
print(players)
Output :
Name Match 1 Match 2 Match 3
0 Virat 55 66 31
1 Rohit 88 66 43
2 Dhoni 99 85 68
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
12
Date : 05.09.23
Ex. No : 13 DISPLAYING DATA USING COLUMN NAMES AND DOT NOTATION
Aim :
To print the batsman name along with runs scored in Test and T20 using column
names and dot notation.
Code :
import pandas as pd
player_data={“Name” : [“Virat ”, “Rahane”, “Rohit”],
“Test” : [3543,2578,2280],
“ODI” : [2245,2165,2080],
“T20” : [1925,1853,1522] }
data = pd.DataFrame(player_data)
data.index = data.index+1
print(data.Name)
print(“Test Record:”)
print(data.Test)
print(“T20 Record:”)
print(data.T20)
Output :
1 Virat
2 Rahane
3 Rohit
Name : Name,dtype: object
Test Record :
1 3543
2 2578
3 2280
Name : Test,dtype: int64
T20 Record :
1 1925
2 1853
3 1522
Name : T20,dtype: int64
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
13
Date : 09.09.23
Ex. No : 14 DISPLAYING DATA USING LOC FUNCTION
Aim :
To print the batsman name along with runs scored in ODIusing loc
Code :
import pandas as pd
player_data={“Name” : [“Virat ”, “Rahane”, “Rohit”],
“Test” : [3543,2578,2280],
“ODI” : [2245,2165,2080],
“T20” : [1925,1853,1522] }
data = pd.DataFrame(player_data)
data.index = data.index+1
print(data.loc[:,(“Name”, “ODI”)])
Output :
Name ODI
1 Virat 2245
2 Rahane 2165
3 Rohit 2080
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
14
Date : 12.09.23
Ex. No : 15 DISPLAYING DATA USING LOC FUNCTION WITH BOOLEAN CONDITION
Aim :
To print the batsman details who scored
a. More than 2000 in ODI
b. Less than 2500 in Test
c. More than 1500 in T20
Code :
import pandas as pd
player_data={“Name” : [“Virat ”, “Rahane”, “Rohit”],
“Test” : [3543,2578,2280],
“ODI” : [2245,2165,2080],
“T20” : [1925,1853,1522] }
data = pd.DataFrame(player_data)
data.index = data.index+1
print(“ Runs greater than 2500 in ODI”)
print(data.loc[data[“ODI”]>2500,[“Name”]])
print(“ Runs less than 2500 in Test”)
print(data.loc[data[“Test”]<2500,[“Name”]])
print(“ Runs more than 1500 in T20”)
print(data.loc[data[“T20”]>1500,[“Name”]])
Output :
Runs greater than 2500 in ODI
Name
1 Virat
2 Rahane
Runs greater than 2500 in Test
Name
3 Rohit
Runs more than 1500 in T20
Name
1 Virat
2 Rahane
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
15
Date : 15.09.23
Ex. No : 16 DISPLAYING DATA USING LINE CHART
Aim :
To plot the following data on line chart and follow the given instructions
Day Monday Tuesday Wednesday Thursday Friday
Income 510 350 475 580 600
a. write title for the chart “The Weekly Income Report”.
b. write appropriate titles of both the axes
c. write code to display legends
d. Display red color for the line
e. Use the line style – dashed
f. Display diamond style markers on data points.
Code :
import matplotlib.pyplot as pp
day=[“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”]
inc=[510,350,475,580,600]
pp.plot(day,inc,label= “Income”,color = “r”, linestyle= “dashed”, marker= “D”)
pp.title(“The Weekly Income Report”)
pp.xlabel(“Days”)
pp.ylabel(“Income”)
pp.legend()
pp.show()
Output :
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
16
Date : 19.09.23
Ex. No : 17 CUSTOMIZING THE LINE CHART
Aim :
To customize the below line chart
Month Masks Sanitizer Handwash
March 1500 4400 6500
April 3500 4500 5000
May 6500 5500 5800
June 6700 6000 6300
July 6000 5600 6200
August 6800 6300 4500
Code :
import matplotlib.pyplot as pp
mon=[“March”, “April” , “May” , “June” , “July” , “August”]
mask=[1500,3500,6500,6700,6000,6800]
san=[4400,4500,5500,6000,5600,6300]
hw=[6500,5000,5800,6300,6200,4500]
pp.plot(mon,mask,label= “Mask”,color= “g”, linestyle= “dashed”, linewidth = 4,\
marker = “o” , markerfacecolor= “k”, markeredgecolor= “r”)
pp.plot(mon,san,label= “Sanitizer”,color= “b”, linestyle = “dashed”, linewidth = 4,\
marker = “3” , markerfacecolor= “k”, markeredgecolor= “g”)
pp.plot(mon,hw,label= “Handwash”,color= “r”, linestyle = “dashed”, linewidth = 4,\
marker = “y” , markerfacecolor= “k”, markeredgecolor= “b”)
pp.title(“Fitwell Medical Store”)
pp.xlabel(“Months”)
pp.ylabel(“Covid Protections”)
pp.legend()
pp.show()
Output :
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
17
Date : 22.09.23
Ex. No : 18 SUB-PLOTTING THE CHART
Aim :
To sub plot the below line chart with respect to sanitizer and handwash data
Month Masks Sanitizer Handwash
March 1500 4400 6500
April 3500 4500 5000
May 6500 5500 5800
June 6700 6000 6300
July 6000 5600 6200
August 6800 6300 4500
Code :
import matplotlib.pyplot as pp
mon=[“March”, “April” , “May” , “June” , “July” , “August”]
san=[4400,4500,5500,6000,5600,6300]
hw=[6500,5000,5800,6300,6200,4500]
pp.subplot(2,1,1)
pp.plot(mon,san,label= “Sanitizer”,color= “b”, linestyle = “dashed”, linewidth = 4,\
marker = “3” , markerfacecolor= “k”, markeredgecolor= “g”)
pp.title(“Fitwell Medical Store”)
pp.legend()
pp.subplot(2,1,2)
pp.plot(mon,hw,label= “Handwash”,color= “r”, linestyle = “dashed”, linewidth = 4,\
marker = “y” , markerfacecolor= “k”, markeredgecolor= “b”)
pp.title(“Fitwell Medical Store”)
pp.xlabel(“Months”)
pp.ylabel(“Covid Protections”)
pp.legend()
pp.show()
Output :
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
18
Date : 25.09.23
Ex. No : 19 DISPLAYING DATA USING BAR CHART
Aim :
To plot the following data on bar chart
Overs Runs
1 6
2 18
3 10
4 5
Code :
import matplotlib.pyplot as pp
overs = [1,2,3,4]
runs=[6,18,10,5]
pp.bar(overs,runs,color= “m”)
pp.xlabel(“overs”)
pp.ylabel(“Runs”)
pp.title(“Bowling Spell Analysis” )
pp.show()
Output :
Result :
Thus the above given Python Program is executed successfully and the output is
verified.
19
Date : 06.10.23
Create the following table products and write queries given below :
Table : Products
Pcode Pname Qty Price Company
P1001 iPad 120 15000 Apple
P1002 LED TV 100 85000 Sony
P1003 DSLR Camera 10 25000 Philips
P1004 iPhone 50 95000 Apple
P1005 LED TV 20 45000 MI
P1006 Bluetooth Speaker 100 20000 Ahuja
Contraints :
Pcode – Primary Key
Pname – Not Null
create table command :
1. To join product and company and display in tabular form like <pname> manufactured
by <company>
20
2. convert all product name into uppercase
3. Display the cube of products quantity for more than or 100 in quantity
4. Divide the price by 3 and display the result with 1 fraction digit for the price of more than
40,000
21
5. Display pname (last four letters only ) , qty, price with 2 decimal points and company for
price in between 30000 and 80000
22
9. Find the difference between maximum price and minimum price from the table
12. Display product number , product name and company in descending order of their price
23
13. Display product minimum price for each company
Result :
Thus the above given My SQL Queries is executed successfully and the output is
verified
24