Practical File 2024
Practical File 2024
FARIDABAD
PRACTICAL RECORD
ROLL NO :
NAME :
CLASS : XII
Name:
Certificate
________________ Class: XII
Roll No. _______________ Exam: AISSCE 2024
________________ ________________
Teacher In Charge Examiner
________________
Principal
Topic: Pandas Series
Expt 1. Create a Series having 7 car makes
import pandas as pd
l=['Toyota', 'Honda', 'Ford', 'BMV', 'Audi', 'Volkswagen', 'Mercedes']
s=pd.Series(l)
print(s)
Expt 2. Create a Series using 2 lists, One having having car makes and the others
having Index of car make as C1,C2, ..... C7
import pandas as pd
m=['Toyota', 'Honda', 'Ford', 'BMV', 'Audi', 'Volkswagen', 'Mercedes']
i=['C1','C2','C3','C4','C5','C6','C7']
s=pd.Series(m,i)
print(s)
Expt 3. Create a Series to store national sports of some countries, indexed by name
of country. (Using a Dictionary)
import pandas as pd
SportsDict={'India':'Hockey', 'Bhutan':'Archery', 'Japan': 'Sumo',
'China': 'Table Tennis', 'England':'Cricket', 'Italy': 'Football',
'Israel': 'Football', 'Iran':'Wresstling', 'USA':'Baseball'}
NationalSports=pd.Series(SportsDict)
print(NationalSports)
Expt 4. Create a Series for storing Subject Name as elements and subject code as
Index. Display various attributes of a Series
''' 1. Display number of elements
2. Display index
3. Display values
4. Display data type of elements
5. Display size of series
6. Display shape of series
7. Display dimension of series
8. Display count of elements in series
9. Display top 5 elements
10. Display last 5 elements
11. Display elements in sorted order (Ascending)
12. Display elements in reverse order
13. Display top 3 and bottom 3 elements
14. Display Statistics of Series
15. Display Info of Series
'''
import pandas as pd
Subjects=['English','Physics','Chemistry','Biology','Mathematics','Accountancy',
'Bus. Studies','Informatics Practices','Painting','History', 'Political Science',
'Home Science', 'Psychology','Entrpreneurship', 'Economics','Physical
Education']
SubCode=['301','042','043','044','041','055','054', '065', '049', '027','028', '064',
'037','066','030', '048']
SubSeries=pd.Series(data=Subjects, index=SubCode)
print("~"*40)
print(SubSeries)
print("~"*40)
print(len(SubSeries)) #1.
print("~"*40)
print(SubSeries.index) #2.
print("~"*40)
print(SubSeries.values) #3.
print("~"*40)
print(SubSeries.dtype) #4.
print("~"*40)
print(SubSeries.size) #5.
print("~"*40)
print(SubSeries.shape) #6.
print("~"*40)
print(SubSeries.ndim) #7.
print("~"*40)
print(SubSeries.count()) #8.
print("~"*40)
print(SubSeries.head()) #9.
print("~"*40)
print(SubSeries.tail()) #10.
print("~"*40)
print(SubSeries.sort_values()) #11.
print("~"*40)
print(SubSeries.sort_values(ascending=False)) #12.
print("~"*40)
print("Top 3 Elements \n",SubSeries.head(3), "Last Three \n" , SubSeries.tail(3))
#13.
print("~"*40)
print(SubSeries.describe()) #14.
print("~"*40)
print(SubSeries.info()) #15.
Expt 5. Create a Series to store Salary of 5 employees of a company. Write
statements to display minimum, maximum, average, total, index of highest and
lowest value. Incremented Salary (after adding 5% of Present Salary), highest 2 and
lowest 2 salaries
import pandas as pd
Salary=[45000,56000,45980, 34890,54000]
print(Salary)
Salary=pd.Series(Salary)
print(Salary)
print("~"*40)
print("Minimum Salary given : ", Salary.min())
print("Maximum Salary given : ", Salary.max())
print("Average Salary given : ", Salary.mean())
print("Total Salary given : ", Salary.sum())
print("Index of Highest Salary : ", Salary.idxmax())
print("Index of Lowest Salary : ", Salary.idxmin())
print("Incremented Salary \n", Salary+(Salary*5/100))
print("Highest 2 Salaries \n", Salary.nlargest(2))
print("Lowest 2 Salaries \n", Salary.nsmallest(2))
Expt 6. Create a Series that store marks of class test taken by 15 student. Display
the Rollnos of students who got marks above 30.
# Also display the result as True/False for Rollnos getting marks above 30 or not
import pandas as pd
TestMarks=[34,65,34,23,19,36,32,67,15,45,10,22,38,56,9]
RollNo=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
Marks=pd.Series(data=TestMarks, index=RollNo)
print(Marks)
print("~"*40)
print(Marks[Marks>30])
print("~"*40)
print(Marks>30)
Expt 7. Create a Series that store marks of class test taken by 15 student. Display
the Rollnos of students who got marks above 30
# Also display the result as True/False for Rollnos getting marks above 30 or not
import pandas as pd
TestMarks=[34,65,34,23,19,36,32,67,15,45,10,22,38,56,9]
RollNo=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
Marks=pd.Series(data=TestMarks, index=RollNo)
print(Marks)
print("~"*40)
print(Marks[Marks>30])
print("~"*40)
print(Marks>30)
Topic: Pandas DataFrame
Expt 8. Write a program to create a DataFrame in Pandas to Store Marks Obtained
by 'Amit','Sumit','Ramit','Namit','Jatin'
# Row Index will be Student Names and Columns Headings will be in 'PT1','PT2'
and 'PT3' [Using Nested Lists-]
import pandas as pd
TestResult=[[23,14,20], [33,41,25], [33,24,29], [43,34,25],[34,40,27]]
tst=pd.DataFrame(TestResult, columns=['PT1','PT2','PT3'],
index=['Amit','Sumit','Ramit','Namit','Jatin'])
print(tst)
import pandas as pd
TestResult={"PT1":[23,33,33,43,34], "PT2":[14,41,24,34,40], "PT3":
[20,25,29,25,27]}
tst=pd.DataFrame(TestResult, index=['Amit','Sumit','Ramit','Namit','Jatin'])
print(tst)
Expt 10. Consider the given Structure and write Python commands to do the questions
that follow:
SportsMan Sport MedalWon
0 Neeraj Chopra Javelin Throw Silver
1 Manu Bhaker Air Pistol Bronze
2 Swapnil Kusale 50 m Rifle Bronze
3 Aman Sehrawat Wrestling Bronze
'''
a. Create a DataFrame Medals using Dictionary
b. Add a row with SportsMan - Indian Men’s Team, Sport - Hockey, MedalWon - Bronze
c. Display the records in arranged in order of SportsMan
d. Add a new column PrizeMoney with values [50 Lakh, 30 Lakh, 30 Lakh, 30 Lakh, 15
Lakh each]
'''
#a.
import pandas as pd
dt={'SportsMan':['Neeraj Chopra', 'Manu Bhaker', 'Swapnil Kusale', 'Aman Sehrawat'],
'Sport': ['Javelin Throw', 'Air Pistol', '50 m Rifle', 'Wrestling'],
'MedalWon':['Silver', 'Bronze', 'Bronze', 'Bronze']}
Medals=pd.DataFrame(dt)
print(Medals)
#b.
Medals.loc[4]=["Indian Men’s Team", 'Hockey', 'Bronze']
print(Medals)
#c.
print(Medals.sort_values(by='SportsMan'))
#d.
Medals['PrizeMoney']= [500000, 300000, 300000, 300000, 150000]
print(Medals)
Expt 11. '''Consider the following Data and write Python Commands to do the
following:
Name Age Gender Height_cms Weight_Kgs
R1 Rohit 25 M 175 70
R2 Surbhi 27 F 160 55
R3 Vanshika 28 F 180 80
R4 Digvijay 32 M 165 60
Expt 13. Write a Python program to create a panda’s DataFrame called DF for the
following table using Dictionary of List and display the details of students whose
Percentage is more than 85.
Topic: Data Viualisation
import pandas as pd
import matplotlib.pyplot as plt
df=pd.DataFrame({'2020':[1000,1200,1400], '2021' : [1200, 1400, 1700], '2022':
[1100,1000,1350], '2023':[1200,1500,1700]}, index=['S1','S2','S3'])
print(df)
df.plot(kind="line", style=["*","p",">","h"], ls=":")
plt.legend()
plt.show()
Expt 16. Plot a Bar Chart
import pandas as pd
import matplotlib.pyplot as plt
RainCoats=[10,22,34,65,23,18,18,20,22]
Umbrella=[100,120,105,110,100,106,112,108,110]
RainyDays=[1,2,3,4,5,6,7,8,9]
plt.scatter(RainyDays, RainCoats, c='m', s=16, label="Rain Coats")
plt.scatter(RainyDays,Umbrella, marker="p", c='darkblue', s=22, label="Umbrella")
plt.legend()
plt.show()
Expt 18. Plot a Histogram
import pandas as pd
df=pd.read_csv("E:\\xii_2022\\testing.csv")
print(df)
Topic: SQL Commands
Expt 21
Q1. Consider the given structure:
Tcode Title Audi Language ShowDt TicketRt
SQL Commands:
a. create table Threater
(Tcode char(4) primary key, Title char(20) not null,
Audi int(1) not null, Language char(10),
ShowDt date, TicketRt int(3));
b. insert into Theatre values
(‘T001’, ‘Romeo and Juliet’, 2, ‘English’, ‘2024-12-12’,150),
(‘T002’, ‘Choked’, 1, ‘Hindi’, ‘2024-10-12’, 150),
(‘T003’, ‘Bahubali’, 3, ‘English’, ‘2024-11-10’, 175);
c. Select title from theater where audi=1 and showdt > sysdate();
d. Select title from theater where language=’Hindi’;
e. Select * from theater order by title;
f. Alter table theater add Troupe chr(40) not null;
g. Delete from theater where ShowDt < sysdate();
h. Update Theater set TicketRt=TicketRt+25 where language=’English’;
i. Select title from theater where language = ‘Hindi’ or language= ‘English’;
j. Select title from theater where ticketRt > 250;
k. Select title from theater order by ticketRt desc;
l. Select title from theater where title like ‘%The%’
Expt 22. . Consider the Data given below-do the questions that follows:
DealerC DealerNm City ContactNo TurnOver
d
SQL Commands:
a. create table Dealers
(DealerCd char(4) primary key, DealerNm char(20) not null,
City char(20) not null, ContactNo char(10), TurnOver float(7,2));
b. Select * from Dealers where DealerNm like ‘R%’;
c. Select DealerNm, TurnOver from Dealers ;
d. Select * from Dealers order by DealerNm
e. Select DealerNm from Dealers where ContactNo is null;
f. Update Dealer set contactNo=’9899999999’ where DealerNm=’Roy Brothers’;
g. Select DealerCd, DealerNm from Dealers where city=’Amritsar’;
h. Select DealerNm from Dealers where city != ‘Delhi’;
i. Select DealerNm from Dealers where TurnOver between 10000 and 20000;
j. Select distinct city from Dealers;
k. Select count(*), count(distict City) from Dealers;
l. Select average(turnover), max(turnover), min(turnover) from Dealers;
Expt 23
Consider the table Projects given below. Write commands in SQL
PROJECTS
Id Projname Projsize Startdate Enddate Cost
Expt 24
Consider the Registration Table given b and write SQL Commands for Questions that follow:
RegsID RName City TestSeries Level Dt_exam ISP Board SCORE RFee
R0001 Poonam Faridabad Physics II 12-03-2020 I-AXN CBSE 56 500
R0002 Deeksha Palwal Maths I 10-03-2020 JIO ICSE 34 450
R0003 Sudeep Faridabad Chemistry II 13-04-2020 AIRTEL CBSE 450
R0004 Vishal Faridabad English II 10-04-2020 BSNL CAMBRIDGE 23 250
R0005 Parul Palwal Maths II 10-01-2020 BSNL CBSE 6 450
R0006 Ranju Ballabgarh Physics I 13-02-2020 AIRTEL CBSE 34 500
R0007 Seema Faridabad Maths I 12-04-2020 JIO ICSE 450
R0008 Ankush Palwal English II 10-03-2020 BSNL STATE 13 250
R0009 Gaurav Faridabad Maths I 15-04-2020 JIO STATE 450
R0010 Pradeep Faridabad Maths II 10-02-2020 AIRTEL ICSE 65 450
R0011 Saumya Ballabgarh Maths I 15-02-2020 AIRTEL ICSE 32 450
R0012 Vaibhav Faridabad Physics II 10-01-2020 JIO CAMBRIDGE 29 500
a. Display how many students from different Boards have registered for Test.
b. Display highest marks scored for every TestSeries.
c. Display Average score upto one decimal place for every city.
d. Display the city having more than 3 registrations.
e. Display the number of registration for different TestSeries in all the Boards.
f. Display how many exams were / are to be conducted on different dates.
g. Display number of users from each ISP.
h. Display from each city what is the total RegistrationFee collected.
i. Display the city from where less than 2 people have registered for Maths test.
j. Display how many students from each city have registered for different Topics
k. Display ISP for which there are more than 5 users.
SQL Commands:
a. Select max(score) , testseries from Registration group by testseries;
b. Select count(*), board from registration group by board;
c. Select round(avg(score),1) , city from Registration group by city;
d. Select count(*) , city from Registration group by city having count(*)>3
e. Select count(*), level, board city from Registration group by board, level order by board;
f. Select count(*), dt_exam from Registration group by dt_exam;
g. Select count(*),ISP from Registration group by ISP;
h. Select sum(rfee),city from registration group by city;
i. Select city from Registration group by city having count(*) < 2 and testseries=’Maths’;
j. Select count(*), city, testseries from registration group by city, testseries;
k. Select isp from registration group by isp having count(*) > 5;
Expt. 25
XYZ media house - DelhI has four blocks named Z1, Z2, Z3, Z4. The distance between blocks is:
Z1 - Z2. 80 mtrs. Z1 - Z3. 65 mtrs. Z1 - Z4. 90 mtrs.
Z2 - Z3. 45 mtrs. Z2 - Z4. 120 mtrs. Z3 - Z4. 60 mtrs.
No. Of computers:
Z1 - 135, Z2 - 290, Z3 - 180, Z4 - 195
120 Mtr
Z2 Z2
45 Mtr
Z3
Repeater - it should be placed between Z2 and Z4 as distance between them is more than
hundred metres.
Hub / Switch - it should be placed in each block as each block has many computer that needs to
be included to form a network.
d. Which technology will allow to make voice call using a broadband Internet connection.
VoIP - Voice Over International Protocol
f. Media house is planning to get its website designed to allow the people to see the news as per
their choice after registering themselves on its server. Out of the static or dynamic which type of
website will you suggest?
g. Suggest a device is software and its placement that provide data security for the entire network
of the media house.