Ip Practical
Ip Practical
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.
(Examiner) (Principal)
___________________
TABLE OF CONTENT
2 My Sql Practicals
PRACTICAL -1
Solution:
Source code:
import pandas as pd
L1=[10,20,30,40,50]
x=pd.Series(L1)
print(x)
Screenshot:
PRACTICAL-2
Solution:
Source Code:
import pandas as pd
l=[“a”,”e”,”i”,”o”,”u”]
vowel=pd.Series(l,index=[1,2,3,4,5])
print(vowel)
Screenshot:
PRACTICAL-3
Solution:
Source Code:
import pandas as pd
x=[20000,35000,90000,15000,85000]
y=[“Banglore”,”Kolkata”,”Chennai”,”Delhi”,”Mumbai”]
population=pd.Series(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=pd.DataFrame(d1,index=[“I”,”II”,”III”,”IV”,”V”])
print(Sport)
PRACTICAL-5
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=pd.Series([54,20,39],index=[“Soap”,”Salt”,”Sugar”])
print(Item)
print(“Modifying values”)
Item[“Soap”]=44
Item[“Sugar”]=42
print(Item)
PRACTICAL-7
Solution
Source Code
import pandas as pd
School=pd.Series(200,index=range(2015,2022))
print(School)
PRACTICAL-8
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=pd.DataFrame(d1,index=L1)
print(Sales)
print(“Displaying row labels”)
print(Sales.index)
print(“Displaying column labels”)
print(Sales.columns)
print(“Displaying last two rows”)
print(Sales.tail(2))
print(“Displaying first two rows of sale”)
print(Sales.head(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=pd.Series([50,80,40,70,20])
print(Staff)
Salaries=pd.Series([10000,20000,30000,85000,90000])
print(Salaries)
AvgSal =Salaries/Staff
print(AvgSal)
AvgSal.index=[“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=pd.DataFrame(d1,index=L1)
print(cloth)
cloth.Cname[“C4”]=”Pant”
print(cloth)
print(“Increase price of cloth by 10%”)
cloth[“Price”]=cloth[“Price”]+cloth[“Price”]*0.1
print(cloth)
cloth.index=[“C001”,”C002”,”C003”,”C004”,”C005”]
print(cloth)
cloth.drop(“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 = pd.Series([45,42,40,46,39,38,40],
['Sunday','Monday','Tuesday','wednesday','Thursday','Friday','Satur
day'])
print(temp)
Solution:
Source Code:
Solution:
Source Code:
Solution:
Source Code:
Solution:
Source Code:
Problem Statement:Given Below are the sugar levels for men and
women in a city.Compare 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 matplotlib.pyplot as plt
men=[113,85,90,150,149,88,93,115]
women=[67,98,89,120,133,150,84,69]
plt.hist([men,women],color=[“green”,”orange”],label=[“men”,”wome
n”])
plt.legend()
plt.show()
MY SQL
PRACTICALS
PRACTICAL-20
Solution:
Source Code:
Solution:
Source Code: