DECLARATION
I bearing roll no. , a student of Class XII The Amrit Indo
Canadian Academy hereby declare that I own the full responsibility for the
information, results etc. provided in this Practical File. It has been created
successfully by using the Database Tool MySQL and SQL commands at
----------------------------in complete fulfillment of practical (curriculum of Central
Board of Secondary Education CBSE of Informatics Practices(065) conducted by
CBSE, New Delhi for the academic session 2022-23.
Name :
Class: XII-E
Roll no. -
CERTIFICATE
This is to certify that the Informatics Practices (065) Practical File has been
successfully completed by ---------------------------------------for consideration in
partial fulfillment of curriculum of Central Board of Secondary Education (CBSE)
of Informatics Practices (065) for the award of AISSCE Practical Examination
2022-23.
I certify that this practical is up to my expectation and as per the guidelines
issued by the CBSE.
(Examiner) (Principal)
___________________
TABLE OF CONTENT
Sr No Topic Page No Remark
1 Data Handling Practicals
2 My Sql Practicals
PRACTICAL -1
Problem Statement 1: Create a series using python sequence
with 5 elements.
Solution:
Source code:
import pandas as pd
L1=[10,20,30,40,50]
x=[Link](L1)
print(x)
Screenshot:
PRACTICAL-2
Problem statement: 1. Create a Series object ‘vowel’ to store all
vowels individually. Its index should be 1,2,3,4 & 5.:
Solution:
Source Code:
import pandas as pd
l=[“a”,”e”,”i”,”o”,”u”]
vowel=[Link](l,index=[1,2,3,4,5])
print(vowel)
Screenshot:
PRACTICAL-3
Problem statement: Create a Series object ‘population’ to store
population of 5 different metro cities and display the population that
are more than 30000:
Solution:
Source Code:
import pandas as pd
x=[20000,35000,90000,15000,85000]
y=[“Banglore”,”Kolkata”,”Chennai”,”Delhi”,”Mumbai”]
population=[Link](x,index=y)
print(population)
print(“population of cities more than 30000 are:”)
print(population[population>30000])
PRACTICAL-4
Problem statement: Create the following dataframe ‘Sport’ containing sport wise
marks for five students. Use 2D dictionary to create dataframe.
Student Sport Marks
I Jai Cricket 80
II Raj Football 76
III John Tennis 89
IV Karan Kabaddi 92
V Chandu Hockey 97
Solution:
Source Code:
import pandas as pd
d1={“Student”:[“Jai”,”Raj”,”John”,”Karan”,”Chandu”],”Sport”:
[“Cricket”,”Football”,”Tennis”,”Kabaddi”,”Hockey”],”Marks”:
[80,76,89,92,97]}
Sport=[Link](d1,index=[“I”,”II”,”III”,”IV”,”V”])
print(Sport)
PRACTICAL-5
Problem statement: No of students in class 11 and class 12 in three
streams (science, commerce and humanities) are stored in 2 series
object class 11 and class 12. write code to find total no of students
in class 11 & class 12 stream wise:
Solution:
Source Code:
import pandas as pd
Class11=[Link]([52,41,25],index=[“Science”,”Commerce”,”Huma
nities”])
print(Class11)
Class12=[Link]([14,22,21],index=[“Science”,”Commerce”,”Huma
nities”])
print(Class12)
print(“Total no. of students”)
print(Class11+Class12)
PRACTICAL-6
Problem statement: Create a Series object ‘Item’ that stores rate of each
product as given below:
Soap 54
Salt 20
Sugar 39
Write code to modify rate of soap to 44 and sugar to 42. print the changed rate
Solution:
Source Code:
import pandas as pd
Item=[Link]([54,20,39],index=[“Soap”,”Salt”,”Sugar”])
print(Item)
print(“Modifying values”)
Item[“Soap”]=44
Item[“Sugar”]=42
print(Item)
PRACTICAL-7
Problem statement: Total no of students to be admitted is 200 in
Convent School every year. Write code to create a Series object
‘School’ that stores these total no of students for the year 2015 to
2022:
Solution
Source Code
import pandas as pd
School=[Link](200,index=range(2015,2022))
print(School)
PRACTICAL-8
Problem statement: Create the following dataframe ‘sales’ containing year
wise sales figure for five sales persons in INR. Use the year as column labels,
and sales person names as row labels.
2014 2015 2016 2017
Madhu 1000 2000 2400 2800
Kusum 1500 1800 5000 6000
Kinshuk 2000 2200 7000 7000
Ankit 3000 3000 1000 8000
Shruti 4000 4500 1250 9000
Write program to do the followings
1. Display row labels of ‘sales’
2. Display column label of ‘sales’
3. Display last two rows of the ‘sales’
4. Display first two rows of the ‘sales’.
Solution:
Source Code:
import pandas as pd
d1={2014:[1000,1500,2000,3000,4000],2015:
[2000,1800,2200,3000,4500],2016:
[2400,5000,7000,1000,1250],2017:
[2800,6000,7000,8000,9000]}
L1=[“Madhu”,”Kusum”,”Kinshuk”,”Ankit”,”Shruti”]
Sales=[Link](d1,index=L1)
print(Sales)
print(“Displaying row labels”)
print([Link])
print(“Displaying column labels”)
print([Link])
print(“Displaying last two rows”)
print([Link](2))
print(“Displaying first two rows of sale”)
print([Link](2))
PRACTICAL-9
Problem statement: Consider two series object staff and salaries that
stores the number of people in various office branches and salaries
distributed in these branches respectively.
Write a program to create another Series object that stores average
salary per branch and then create a dataframe object from these
Series object. After creating dataframe rename all row labels with
Branch name.
Solution:
Source Code:
import pandas as pd
Staff=[Link]([50,80,40,70,20])
print(Staff)
Salaries=[Link]([10000,20000,30000,85000,90000])
print(Salaries)
AvgSal =Salaries/Staff
print(AvgSal)
[Link]=[“sale”,”marketing”,”HR”,”maintenance”,”store”]
print(AvgSal)
SCREENSHOT:
output
PRACTICAL-10
Problem statement: Create a dataframe ‘cloth’ as given below and write
program to do followings:
Change the name of ‘Trouser’ to ‘pant’ and Jeans to ‘Denim’
Increase price of all cloth by 10%
Rename all the indexes to [C001, C002, C003, C004, C005]
Delete the data of C3 (C003) from the ‘cloth’
Delete size from ‘cloth’
CName Size Price
C1 Jeans L 1200
C2 Jeans XL 1350
C3 Shirt XL 900
C4 Trouser L 1000
C5 T-Shirt XL 600
Solution:
Source Code:
import pandas as pd
d1={“CName”:[“Jeans”,”Jeans”,”Shirt”,”Trouser”,”TShirt”],”Size”:
[“L”,”XL”,”XL”,”L”,”XL”],”Price”:[1200,1350,900,1000,600]}
L1=[“C1”,”C2”,”C3”,”C4”,”C5”]
cloth=[Link](d1,index=L1)
print(cloth)
[Link][“C4”]=”Pant”
print(cloth)
print(“Increase price of cloth by 10%”)
cloth[“Price”]=cloth[“Price”]+cloth[“Price”]*0.1
print(cloth)
[Link]=[“C001”,”C002”,”C003”,”C004”,”C005”]
print(cloth)
[Link](“C003”)
print(cloth)
del cloth[“Size”]
print(cloth)
Output
PRATICAL 11
Problem statement: Create a series ‘temp’ that stores temperature of seven
days in it. Its index should be ‘Sunday’, ‘Monday’ ….
Write script to
1. Display temp of first 3 days.
2. Display temp of last 3 days.
3. Display all temp in reverse order like Saturday, Friday,….
4. Display temp from Tuesday to Friday.
5. Display square of all temperature.:
Solution:
Source Code:
import pandas as pd
temp = [Link]([45,42,40,46,39,38,40],
['Sunday','Monday','Tuesday','wednesday','Thursday','Friday','Satur
day'])
print(temp)
print("Temp of first three days\
n",[Link](3))
print("Temp of last three days\
n",[Link](3))
print("Temp in reverse order\n",
temp[::-1])
print("Temp from Tuesday to Friday\
n",temp['Tuesday':'Friday'])
print("Square of all Temprature\n",temp*temp)
PRACTICAL-15
Problem statement: Collect and store total medals won by 10
countries in Olympic games and represent it in form of bar chart with
title to compare an analyze data.
Solution:
Source Code:
import [Link] as plt
medals=[150,200,100,250,300,400,350,800,600,550]
countries=[“Japan”,”USA”,”France”,”Australia”,”Nepal”,”Brazil”,”Paki
stan”,”Canada”,”India”,”China”]
[Link](countries,medals)
[Link](“Countries”)
[Link](“Medals won”)
[Link](“Olympic medal tally”)
[Link]()
PRACTICAL-16
Problem statement: Techtipnow Automobiles is authorized dealer of different
Bikes companies. They record the entire sale of bikes month wise as give
below:
Jan Feb Mar Apr May Jun
Honda 23 45 109 87 95 100
Suzuki 45 57 75 60 50 30
Tvs 97 80 84 68 80 108
Solution:
Source Code:
import [Link] as plt
x=[“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”]
honda=[23,45,109,87,95,100]
suzuki=[45,57,75,60,50,30]
tvs=[97,80,84,68,80,108]
[Link](x,honda,label=”Honda”)
[Link](x,suzuki,label=”Suzuki”)
[Link](x,tvs,label=”Tvs”)
[Link](“Month”)
[Link](“Sales”)
[Link](“Sales Analysis”)
[Link]()
PRACTICAL-17
Problem Statement: Consider two lists by a user- one of daily
activities and other of time taken to do those activities,Draw a
pie chart to depict the same.
Solution:
Source Code:
import [Link] as plt
x=[“eating”,”going out”,”play”,”study”,”work”,”sleep”]
y=[2,6,9,7,1,4]
c=[“green”,”brown”,”yellow”,”red”,”orange”,”blue”]
[Link](y,labels=x,colors=c)
[Link]()
PRACTICAL-18
Problem Statement: Plot a line chart to compare population growth of
India and Pakistan.
Solution:
Source Code:
import [Link] as plt
years=[1970,1980,1990,2000,2010,2020]
ind=[120,200,250,300,400,500]
pak=[50,100,120,130,150,160]
[Link](years,ind,color=”orange”,label=”India”)
[Link](years,pak,color=”green”,label=”Pakistan”)
[Link](“years”)
[Link](“Population growth”)
[Link](“Pop. Growth of India and Pakistan”)
[Link]()
[Link]()
PRACTICAL-19
Problem Statement:Given Below are the sugar levels for men and
women in a [Link] the sugar levels amongst them through a
histogram.
Men:[113,85,90,150,149,88,93,115]
Women:[67,98,89,120,133,150,84,69]
Solution:
Source Code:
import [Link] as plt
men=[113,85,90,150,149,88,93,115]
women=[67,98,89,120,133,150,84,69]
[Link]([men,women],color=[“green”,”orange”],label=[“men”,”wome
n”])
[Link]()
[Link]()
MY SQL
PRACTICALS
PRACTICAL-20
Problem statement: Create a student table with the student id,
name, and marks as attributes where the student id is the primary
key.
Solution:
Source Code:
Create table student(StuID int(4) Primary Key,Name
varchar(20),Marks int(10));
PRATICAL 21
Problem statement: In the table ‘student’ created in practical 26, insert the
details of new students.
Solution:
Source Code:
insert into student values(1,”sanjay”,67);
insert into student values(2,”surendra”,88);
insert into student values(3,”Jamil”,74);
insert into student values(4,”Rahul”,92);
insert into student values(5,”Prakash”,78);