VANDANA INTERNATIONAL SCHOOL
NEW DELHI
A
CLASS XII
PRACTICAL FILE
OF
ARTIFICIAL INTELLIGENCE (843)
SESSION 2025-26
SUBMITTED BY : LAKSHYA
ROLL NUMBER :
___________________
⭐ACKNOWLEDGEMENT⭐
I would like to express my sincere gratitude
to my respected teacher, Ms Rashmi Duggal,
for their invaluable guidance, encouragement,
and constant support throughout the
completion of this Artificial Intelligence
practical file.
I am also thankful to my school principal, Mr
Ved Prakash Tondon, for providing the
necessary facilities and environment to carry
out these practical’s successfully.
Finally, I extend my heartfelt thanks to my
family and friends for their continuous
encouragement and motivation.
Lakshya
Roll Number:
⭐ CERTIFICATE ⭐
This is to certify that Lakshya of Class
XII, Roll Number ____ , has successfully
completed the practical work in Artificial
Intelligence (Code: 843) for the academic
session 2025–26 as prescribed by the
CBSE, under my supervision and guidance.
The work submitted in this file is original
and satisfies all the requirements for the
subject practical examination.
Signature of Teacher(Ms Rashmi Duggal)
Signature of Examiner
Date: ___________
PRACTICAL NO. -1
Question: Write Python code to create a Pandas
DataFrame using any sequence data type.
Program: import pandas as pd
# creating a 2D dictionary
dict{"Student":[Link](["Arnav","Neha","Priya","R
ahul",”Utkarsh”,”Niyati”],
index=["Data 1","Data 2","Data 3","Data 4",”Data
5”,”Data 6”]),
"Marks": [Link]([85, 92, 78, 83, 90, 89],
index=["Data 1","Data 2","Data 3","Data 4", “Data
5”, “Data 6”]),
"Sports":[Link](["Cricket","Volleyball","Hockey","
Badminton",”Table Tennis”,”khoKho”],
index=["Data 1","Data 2","Data 3","Data 4",”Data
5”, “Data 6”])} ,
# creating a DataFrame
df = [Link](dict)
PRACTICAL NO. -1.1
a) Display the DataFrame
Program: import pandas as pd
# creating a 2D dictionary
dict = {"Student":
[Link](["Arnav","Neha","Priya","Rahul",”Utkarsh”
,”Niyati”],
index=["Data 1","Data 2","Data 3","Data 4",”Data
5”,”Data 6”]),
"Marks": [Link]([85, 92, 78, 83, 90, 89],
index=["Data 1","Data 2","Data 3","Data 4", “Data
5”, “Data 6”]),
"Sports":[Link](["Cricket","Volleyball","Hockey","
Badminton",”TableTennis”,”khoKho”],
index=["Data 1","Data 2","Data 3","Data 4",”Data
5”, “Data 6”])} ,
# creating a DataFrame
df = [Link](dict)
# printing this DataFrame on the output screen
print(df)
Output: Student Marks Sports
Data 1 Arnav 85 Cricket
Data 2 Neha 92 Volleyball
Data 3 Priya 78 Hockey
Data 4 Rahul 83 Badminton
Data 5 Utkarsh 90 Table Tennis
Data 6 Niyati 89 Khokho
PRACTICAL NO. -1.2
b) Display first 5 records.
Program: import pandas as pd
# creating a 2D dictionary
dict = {"Student":
[Link](["Arnav","Neha","Priya","Rahul","Utkarsh","Niy
ati"],
index=["Data 1","Data 2","Data 3","Data 4","Data
5","Data 6"]),
"Marks": [Link]([85, 92, 78, 83, 90,89],
index=["Data 1","Data 2","Data 3","Data 4","Data
5","Data 6"]),
"Sports":[Link](["Cricket","Volleyball","Hockey","Badmi
nton","TableTennis","Khokho"],
index=["Data 1","Data 2","Data 3","Data 4","Data
5","Data 6"])}
# creating a DataFrame
df = [Link](dict)
# printing first five records on the output screen
print([Link](5))
Output: Student Marks Sports
Data 1 Arnav 85.0 Cricket
Data 2 Neha 92.0 Volleyball
Data 3 Priya 78.0 Hockey
Data 4 Rahul 83.0 Badminton
Data 5 NaN 90.0 Table Tennis
PRACTICAL NO. -1.3
c) Display last 3 records.
Program: import pandas as pd
# creating a 2D dictionary
dict = {"Student":
[Link](["Arnav","Neha","Priya","Rahul","Utkarsh","Niya
ti"],
index=["Data 1","Data 2","Data 3","Data 4","Data
5","Data 6"]),
"Marks": [Link]([85, 92, 78, 83, 90,89],
index=["Data 1","Data 2","Data 3","Data 4","Data
5","Data 6"]),
"Sports":[Link](["Cricket","Volleyball","Hockey","Badmi
nton","Table Tennis","Khokho"],
index=["Data 1","Data 2","Data 3","Data 4","Data
5","Data 6"])}
# creating a DataFrame
df = [Link](dict)
# printing last three records on the output screen
print([Link](3))
Output:
Student Marks Sports
Data 4 Rahul 83 Badminton
Data 5 Utkarsh 90 Table Tennis
Data 6 Niyati 89 Khokho
PRACTICAL NO. -1.4
d) Display the number of missing values in the dataset.
Program: import pandas as pd
import numpy as np
# creating a 2D dictionary
dict =
{"Student":[Link](["Arnav","Neha","Priya","Rahul","Utkarsh","Niyati"]
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data 6"]),
"Marks": [Link]([85, 92, [Link], 83, [Link],89],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data 6"]),
"Sports":[Link](["Cricket","Volleyball","Hockey","Badminton","Table
Tennis","Khokho"],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data 6"])}
# creating a DataFrame
df = [Link](dict)
print(df)
print(“Number of missing values:”)
print([Link]().sum())
Output: Student Marks Sports
Data 1 Arnav 85.0 Cricket
Data 2 Neha 92.0 Volleyball
Data 3 Priya NaN Hockey
Data 4 Rahul 83.0 Badminton
Data 5 Utkarsh NaN Table Tennis
Data 6 Niyati 89.0 Khokho
Number of missing values:
Student 0
Marks 2
Sports 0
dtype: int64
PRACTICAL NO. -1.5
e) Delete row from DataFrame.
Program: import pandas as pd
import numpy as np
# creating a 2D dictionary
dict = {"Student":
[Link](["Arnav","Neha","Priya","Rahul","Utkarsh","Niyati"],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data 6"]),
"Marks": [Link]([85, 92, [Link], 83, [Link],89],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data 6"]),
"Sports":[Link](["Cricket","Volleyball","Hockey","Badminton","Tab
le Tennis","Khokho"],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data 6"])}
# creating a DataFrame
df = [Link](dict)
print(df)
df = [Link]("Data 2", axis=0)
print(df)
Output: Student Marks Sports
Data 1 Arnav 85.0 Cricket
Data 2 Neha 92.0 Volleyball
Data 3 Priya NaN Hockey
Data 4 Rahul 83.0 Badminton
Data 5 Utkarsh NaN Table Tennis
Data 6 Niyati 89.0 Khokho
Student Marks Sports
Data 1 Arnav 85.0 Cricket
Data 3 Priya NaN Hockey
Data 4 Rahul 83.0 Badminton
Data 5 Utkarsh NaN Table Tennis
Data 6 Niyati 89.0 Khokho
PRACTICAL NO. -1.6
f) Delete column from DataFrame
Program: import pandas as pd
import numpy as np
# creating a 2D dictionary
dict = {"Student":
[Link](["Arnav","Neha","Priya","Rahul","Utkarsh","Niyati"
],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data
6"]),
"Marks": [Link]([85, 92, [Link], 83, [Link],89],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data
6"]),
"Sports":[Link](["Cricket","Volleyball","Hockey","Badminto
n","Table Tennis","Khokho"],
index=["Data 1","Data 2","Data 3","Data 4","Data 5","Data
6"])}
# creating a DataFrame
df = [Link](dict)
print(df)
df = [Link]("Sports", axis=1)
print(df)
Output: Student Marks Sports
Data 1 Arnav 85.0 Cricket
Data 2 Neha 92.0 Volleyball
Data 3 Priya NaN Hockey
Data 4 Rahul 83.0 Badminton
Data 5 Utkarsh NaN Table Tennis
Data 6 Niyati 89.0 Khokho
PRACTICAL NO. -6
Question: Create a data story with the information given
below. Use the data to create an effective Data Story.
Solution:
Step 1: Prepare dataset in MS Excel.
Step 2: Visualize the data using Line chart
Death without vaccination Death with Vaccination
7000
6000
5000
4000
3000
2000
1000
0
21
1
20
20
20
02
02
02
02
02
02
02
02
20
20
20
20
,2
,2
,2
,2
,2
,2
,2
,2
1,
1,
1,
1,
15
31
15
31
15
30
15
31
n
ct
ov
ec
Ja
n
ct
ct
ov
ov
ec
ec
O
Ja
Ja
O
Step 3: Narrative:
Data Story: The Life-Saving Power of Vaccination
Objective:
To evaluate the impact of vaccination on the number of deaths due to a
disease during the observed period.
As vaccination coverage increased, the number of deaths in the vaccinated
population decreased drastically, even while deaths in the unvaccinated
population continued rising.
By the end of the 4-month period, vaccines reduced death tolls by up to
98%, proving their life-saving effect.
Conclusion:
Vaccination is not just a preventive measure—it’s a powerful shield that
saves lives. This data story clearly demonstrates that even as infections
spread and fatalities rose in the general population, those who received the
vaccine were much safer.
PRACTICAL NO. -3
Question: Consider the following data
X Y
44 47
46 48
48 55
50 58
52 49
Regression Equation: 0.7x + 17.8
Calculate the MSE & RMSE (Root means Square Error) for the
above data using Excel.
Solution:
Step 1: Enter the Data
In Column A1, input the given X values.
In Column B1, input the Y values.
Fill in the data under the respective columns.
Step 2: Calculate Predicated value by using the above equation
Label Column C1 as Predicted value.
In Cell C2, enter the formula: =0.7*A2+17.8
Drag this formula down to fill all rows (C3:C6). This
calculates the predicted value for each row.
Step 3: Calculate Squared Errors
Label Column D1 as Residual Squared Error.
In Cell D2, enter the formula: =power((C2−𝐵2),2)
Drag this formula down to fill all rows (D3:D6). This
calculates the squared error for each row.
Step 4: Calculate the Mean Squared Error (MSE)
In an empty cell E1, label it MSE.
In E2, use the formula: =𝐴𝑉𝐸𝑅𝐴𝐺𝐸(D2:D6)
This computes the average of all squared errors.
Step 5: Calculate the Root Mean Squared Error (RMSE)
In an empty cell F1, label it RMSE.
In F2, use the formula: =𝑆𝑄𝑅𝑇(E2)
This takes the square root of the MSE to compute the
RMSE.