Class 12 IP
Class 12 IP
HOLIDAY HOMEWORK
2025-26
Class XII- IP
Section A
Q1. What is the purpose of index attribute in dataframe:
(a) Fetch the dimension of the given dataframe
(b) Fetch the size of the given dataframe
(c) Fetch both index and column names of the given dataframe
(d) Fetch the index’s name in the dataframe
Q2. What is the purpose of ndim attribute in dataframe:
(a) Fetch the dimension of the given dataframe
(b) Fetch the size of the given dataframe
(c) Fetch both index and column names of the given dataframe
(d) Fetch the data type values of the items in the dataframe
Q3. What is the purpose of size attribute in dataframe:
(a) Fetch the dimension of the given dataframe
(b) Fetch the size of the given dataframe
(c) Fetch both index and column names of the given dataframe
(d) Fetch the data type values of the items in the dataframe
Q4. What is the purpose of axes attribute in dataframe:
(a) Fetch the dimension of the given dataframe
(b) Fetch the size of the given dataframe
(c) Fetch both index and column names of the given dataframe
(d) Fetch the index’s name in the dataframe
Q5. From the 6th display the 3rd, 4th and 5th columns from 6th to 9th rows of a dataframe DF, you can write
______________.
(a) DF.loc[6:9,3:5] (b) DF.loc[6:10,3:6] (c) DF.iloc[6:10,3:6] (d) DF.iloc[6:9,3:5]
Q6. To change the 5th column’s value at 3rd row as 35 in dataframe DF you can write ________.
(a) DF.loc[4,6]=35 (b) DF[3,5]=35 (c) Df.iat[4,6]=35 (d) Df.iat[3,5]=35
Q7. Which among the following options can be used to create a DataFrame in Pandas?
(a) A scalar value (b) An ndarray (c) A python (d) All of these
Q8. What is the output of the following code:
import pandas as pd
resultDict={'Mohit':pd.Series([76,98,54], index=['Physics','Chemistry', 'Maths']),\
'Priya':pd.Series([65,87,43],index=['Physics','Chemistry', 'Maths']),\
'Deep':pd.Series([60,75,83],index=['Physics','Chemistry', 'Maths'])}
resultDF=pd.DataFrame(resultDict)
print(resultDF.T)
(a) Mohit Priya Deep (b) Physics Chemistry Maths
Physics 76 65 60 Mohit 76 98 54
Chemistry 98 87 75 Priya 65 87 43
Maths 54 43 83 Deep 60 75 83
(c) Wrong Code (d) None of these
Q9. Consider the following snippet:
import pandas as pd
resultDict={'Jyoti':pd.Series([76,98,54], index=['Physics','Chemistry', 'Maths']),\
'Vanshi':pd.Series([65,87,43],index=['Physics','Chemistry', 'Maths']),\
'Aviral':pd.Series([60,75,83],index=['Physics','Chemistry', 'Maths']),\
'Ankita':pd.Series([63,78,80],index=['Physics','Chemistry', 'Maths'])}
resultDF=pd.DataFrame(resultDict)
print(resultDF.count())
(a) Jyoti 3 (b) Physics 4
Vanshi 3 Chemistry 4
Aviral 3 Maths 4
Ankita 3 dtype: int64
dtype: int64
(c) Both (a) and (b) (d) None of these
Q1 Consider the following snippet:
0. import pandas as pd
resultDict={'Jyoti':pd.Series([76,98,54], index=['Physics','Chemistry', 'Maths']),\
'Vanshi':pd.Series([65,87,43],index=['Physics','Chemistry', 'Maths']),\
'Aviral':pd.Series([60,75,83],index=['Physics','Chemistry', 'Maths']),\
'Ankita':pd.Series([63,78,80],index=['Physics','Chemistry', 'Maths'])}
resultDF=pd.DataFrame(resultDict)
print(resultDF.T.count())
(a) Jyoti 3 (b) Physics 4
Vanshi 3 Chemistry 4
Aviral 3 Maths 4
Ankita 3 dtype: int64
dtype: int64
(c) Both (a) and (b) (d) None of these
Section B
1. Write code to create a Series object using the Python sequence [11,21,31,41]. Assume that Pandas is imported as
alias name pd.
2. Write code to create a Series object using the Python sequence (1,2,3,4). Assume that Pandas is imported as alias
name pd.
3. Write a program to create a Series object using individual characters ‘o’,’h’, and ‘o’. Assume that Pandas is
imported alias name pd.
4. Write a program to create a Series object using a string: “So funny”. Assume that Pandas is imported as alias
name pd.
5. Write a program to create a Series object using three different words : “I”, “am”, “laughing”.Assume that Pandas
is imported as alias name pd.
6. Write a program to create a Series object using an ndarray that has 5 elements in the ranges 24 to 64.
7. Write a program to create a Series object using an ndarray that is created by tiling a list [3,5], twice.
8. Write a program to create a Series object using a dictionary that stores the number of students in each section of
class 12 in your school.
9. Write a program to create a Series object that stores initial budget allocated (50000/- each) for the four quarters
of the years: Qtr1, Qtr2, Qtr3 and Qtr4.
10.Total number of medals to be won is 200 in the Inter University games held every alternate year. Write code to
create a Series object that these medals for games to be held in the decade 2020-2029.
11.A Python list namely section stores the section names (‘A’, ‘B’, ‘C’, ‘D’) of class 12 in your school. Another list contri
stores the contribution made by these students to a charity fund endorsed by the school. Write code to create a
Series object that stores the contribution amount as the values and the section names as the indexes.
12.Sequence section and contri1 store the section names (‘A’, ‘B’, ‘C’, ‘D’) and contribution made by them
respectively (6700, 5600, 5000, 5200, nil) for a charity. Your school has decided to donate as much contribution as
made by each section, i.e. the donation will be doubled.
13.Consider the rows series objects s11 and s12 that you created in examples 11 and 12 respectively. Print the
attributes of both these objects in a report form as shown below:
Attribute name Object s11 Object s12
Data type
Shape
No. of bytes
No. of dimensions
Item size
Has NaNs?
Empty?
14.Consider a Series object s8 that stores the number of students in each section of class 12 (as shown below)
Vanya 65
Sanya 87
Manya 89
15.Consider the Series object s13 that stores the contribution of each section, as shown below:
A 13400.0
B 11200.0
C 10000.0
D 10400.0
E NaN
16.A Series object trdata consist of around 2500 rows of data. Write a program to print the following details :