Official CBSE Study Materials for Class 12 Informatics Practices
Review targeted academic resources with the CBSE Class 12 Informatics Practices Data Handling using Pandas I Case Study Questions Set 01. Built according to official CBSE standards for the 2026-27 term, these downloadable Class 12 Informatics Practices study materials support effective daily practice and deeper conceptual understanding for Data Handling using Pandas I.
Advanced Resources for Informatics Practices
Navigate directly to the advanced Informatics Practices study materials using the digital viewer below. Each resource pack includes detailed conceptual summaries and solved practice questions, allowing students to instantly reinforce their learning.
Case Study Based Questions
Case Study 1: Mr. Ankit works in an organisation as a data analyst and uses Python Pandas and Matplotlib. He has a dataset of passengers for the years 2010 to 2012 for January, March and December. His manager wants certain information from him, but he is facing some problems. Help him by answering the questions given below.
| Year | Month | Passengers | |
|---|---|---|---|
| 0 | 2010 | Jan | 25 |
| 1 | 2010 | Mar | 50 |
| 2 | 2012 | Jan | 35 |
| 3 | 2010 | Dec | 55 |
| 4 | 2012 | Dec | 65 |
Code to create the above DataFrame:
import pandas as ____________ #Statement 1
data={"Year":[2010,2010,2012,2010,2012],"Month":["Jan","Mar","Jan","Dec","Dec"],
"Passengers":[25,50,35,55,65]}
df=pd.____________________(data) #Statement 2
print(df)(a)
pd(b)
df(c)
data(d)
pShow Answer & Explanation
Answer: (a) pd
Explanation:
1. Statement 2 calls the function as pd.____(data), so the pandas library must be known by the name pd.
2. The alias is given with import pandas as pd, so Statement 1 needs pd.
Teacher's Note:
1. The alias in the import line must match the name used later in the program.
2. Here df is the DataFrame and data is the dictionary, so neither can be the alias.
(a)
Dataframe(b)
DataFrame(c)
Series(d)
DictionaryShow Answer & Explanation
Answer: (b) DataFrame
Explanation:
1. The output is a two-dimensional table with three columns, so a DataFrame is needed.
2. Python is case-sensitive and the pandas function is spelt DataFrame with capital D and F.
3. So Statement 2 is df=pd.DataFrame(data).
Teacher's Note:
1. pd.Dataframe (small f) gives an AttributeError because no such name exists.
2. A Series is one-dimensional and cannot hold the three named columns.
(5, 3)(a)
df.index(b)
df.shape()(c)
df.shape(d)
df.sizeShow Answer & Explanation
Answer: (c) df.shape
Explanation:
1. (5, 3) means 5 rows and 3 columns, which is the shape of the DataFrame.
2. shape is an attribute (a tuple), not a method, so it is written without brackets.
3. So the answer is df.shape.
4. df.shape() gives TypeError: 'tuple' object is not callable; df.size gives 15 and df.index gives RangeIndex(start=0, stop=5, step=1).
Teacher's Note:
1. shape, size, index and columns are attributes, so they never take brackets.
2. size is always rows multiplied by columns, here 5 x 3 = 15.
| Month | Passengers | |
|---|---|---|
| 0 | Jan | 25 |
| 2 | Jan | 35 |
(a)
df.loc[['Month','Passengers']][df['Month']=='Jan'](b)
df[['Month','Passengers']][df['Month']=='Jan'](c)
df.iloc[['Month','Passengers']][df['Month']=='Jan'](d)
df(['Month','Passengers']][df['Month']=='Jan')Show Answer & Explanation
Answer: (b) df[['Month','Passengers']][df['Month']=='Jan']
Explanation:
1. df[['Month','Passengers']] selects the two columns (a list of column names inside square brackets).
2. [df['Month']=='Jan'] is boolean indexing that keeps only the rows where Month is Jan (rows 0 and 2).
3. So the answer is df[['Month','Passengers']][df['Month']=='Jan'].
4. Option (a) looks for row labels 'Month' and 'Passengers' (KeyError), option (c) gives iloc names instead of positions (ValueError) and option (d) uses round brackets (SyntaxError).
Teacher's Note:
1. loc and iloc take row labels or positions first, so a list of column names alone does not work with them.
2. The same result can also be written as df.loc[df['Month']=='Jan', ['Month','Passengers']].
| Year | Month | Passengers | |
|---|---|---|---|
| Air India | 2010 | Jan | 25 |
| Indigo | 2010 | Mar | 50 |
| Spicejet | 2012 | Jan | 35 |
| Jet | 2010 | Dec | 55 |
| Emirates | 2012 | Dec | 65 |
(a)
df.index[]=["Air India","Indigo","Spicejet","Jet","Emirates"](b)
df.index["Air India","Indigo","Spicejet","Jet","Emirates"](c)
df.index=["Air India","Indigo","Spicejet","Jet","Emirates"](d)
df.index()=["Air India","Indigo","Spicejet","Jet","Emirates"]Show Answer & Explanation
Answer: (c) df.index=["Air India","Indigo","Spicejet","Jet","Emirates"]
Explanation:
1. The row labels of a DataFrame are stored in its index attribute.
2. Assigning a list with one label per row replaces the index: df.index=["Air India","Indigo","Spicejet","Jet","Emirates"].
3. Options (a) and (d) are syntax errors and option (b) tries to read from the index instead of assigning to it (IndexError).
Teacher's Note:
1. The new list must have exactly as many labels as there are rows (5 here), otherwise a ValueError is raised.
2. To rename only some labels, df.rename(index={0:'Air India'}) can be used instead.
Case Study 2: Answer the following questions based on the Series given below.
import pandas as pd
list1=[1,2,3,4,5,6,7,8]
list2=['swimming','tt','skating','kho kho','bb','chess','football',"cricket"]
school=pd.Series(list1,index=list2)
school.name=("little")
print(school*2) #Statement 1
print(school.tail(3)) #Statement 2
print(school["tt"]) #Statement 3
print(school[2:4]) #Statement 4name attribute) of the Series created above?(a)
list1(b)
list2(c)
school(d)
littleShow Answer & Explanation
Answer: (d) little
Explanation:
1. The statement school.name=("little") sets the name attribute of the Series.
2. school is only the variable that refers to the Series; list1 gives the values and list2 gives the index labels.
3. So the name of the Series is little, and it is printed as Name: little below the output.
Teacher's Note:
1. A Series name also becomes the column name when the Series is put into a DataFrame.
2. The variable name and the name attribute are two different things.
print(school.tail(3))(a)
swimming 1 tt 2 skating 3 Name: little, dtype: int64
(b)
chess 6 football 7 cricket 8 Name: little, dtype: int64
(c)
4(d)
kho kho 4 bb 5 chess 6 football 7 cricket 8 Name: little, dtype: int64
Show Answer & Explanation
Answer: (b)
chess 6 football 7 cricket 8 Name: little, dtype: int64
Explanation:
1. tail(n) returns the last n elements of a Series.
2. The last three labels are chess, football and cricket with values 6, 7 and 8.
3. So the output is option (b), followed by Name: little, dtype: int64.
Teacher's Note:
1. head(n) gives the first n elements and tail(n) the last n; both default to 5.
2. Option (a) is the output of head(3) and option (d) is the output of tail(5).
print(school["tt"])(a)
2(b)
3(c)
tt 2
(d)
TrueShow Answer & Explanation
Answer: (a) 2
Explanation:
1. 'tt' is one index label, and the value stored against it is 2.
2. Selecting a single label returns just the value, not a Series, so the output is 2.
Teacher's Note:
1. A single label gives a scalar value, while a list of labels such as school[['tt']] gives a Series.
2. The label must be written exactly as in the index, including case.
print(school[2:4])(a)
skating 3 kho kho 4 Name: little, dtype: int64
(b)
tt 2 skating 3 kho kho 4 Name: little, dtype: int64
(c)
skating 3 kho kho 4 bb 5 Name: little, dtype: int64
(d)
skating 3 kho kho 4 bb 5 chess 6 football 7 cricket 8 Name: little, dtype: int64
Show Answer & Explanation
Answer: (a)
skating 3 kho kho 4 Name: little, dtype: int64
Explanation:
1. A slice with numbers uses positions, which start from 0.
2. [2:4] takes positions 2 and 3; the end position 4 is not included.
3. Position 2 is skating (3) and position 3 is kho kho (4), so the output is option (a).
Teacher's Note:
1. In a positional slice the stop value is excluded, but in a label slice like school['tt':'bb'] it is included.
2. Writing school.iloc[2:4] makes it clear that positions are being used.
print(school*2)(a)
swimming 3 tt 4 skating 5 kho kho 6 bb 7 chess 8 football 9 cricket 10 Name: little, dtype: int64
(b)
swimming 2 tt 4 skating 6 kho kho 8 bb 10 chess 12 football 14 cricket 16 Name: little, dtype: int64
(c)
swimming False tt False skating True kho kho True bb True chess True football True cricket True Name: little, dtype: bool
(d)
swimming 1 tt 4 skating 9 kho kho 16 bb 25 chess 36 football 49 cricket 64 Name: little, dtype: int64
Show Answer & Explanation
Answer: (b)
swimming 2 tt 4 skating 6 kho kho 8 bb 10 chess 12 football 14 cricket 16 Name: little, dtype: int64
Explanation:
1. A mathematical operation on a Series is applied to every element (vectorised operation).
2. school*2 doubles each value: 1, 2, ..., 8 become 2, 4, ..., 16.
3. So the output is option (b).
Teacher's Note:
1. Option (a) is school+2, option (c) is school>2 and option (d) is school**2.
2. The index labels and the Series name stay the same after the operation.
Case Study 3: Sanyukta is the event in-charge in a school. One of her students suggested using Python Pandas and Matplotlib for analysing and visualising data. She has created a DataFrame df (the SportsDay data) to keep track of the number of First, Second and Third prizes won by different houses in various events.
| House | First | Second | Third | |
|---|---|---|---|---|
| 0 | Chenab | 5 | 7 | 6 |
| 1 | Ganges | 10 | 5 | 4 |
| 2 | Jamuna | 8 | 13 | 15 |
| 3 | Jhelum | 12 | 9 | 12 |
| 4 | Ravi | 5 | 11 | 10 |
| 5 | Satluj | 10 | 5 | 3 |
Write Python commands to do the following:
(a)
df['House'][(df['Second']>=12) and (df['Second']<=20)](b)
df[House][(df['Second']>=12) & (df['Second']<=20)](c)
df['House'][(df['Second']>=12) & (df['Second']<=20)](d)
df[(df['Second']>=12) & (df['Second']<=20)]Show Answer & Explanation
Answer: (c) df['House'][(df['Second']>=12) & (df['Second']<=20)]
Explanation:
1. Two conditions on a Series are joined with & (not the word and), and each condition is put in brackets.
2. df['House'] picks only the house names, and the condition keeps the rows with Second between 12 and 20.
3. So the answer is df['House'][(df['Second']>=12) & (df['Second']<=20)], which gives Jamuna.
4. Option (a) gives ValueError (truth value of a Series is ambiguous), option (b) gives NameError (House without quotes) and option (d) shows the whole row, not just the name.
Teacher's Note:
1. Use & for and, | for or and ~ for not when filtering with conditions in pandas.
2. Forgetting the brackets around each condition is a common error because & is evaluated before >=.
(a)
print(df[::1])(b)
print(df.iloc[::-1])(c)
print(df[-1:]+df[:-1])(d)
print(df.reverse())Show Answer & Explanation
Answer: (b) print(df.iloc[::-1])
Explanation:
1. A slice with step -1 goes from the last row to the first.
2. df.iloc[::-1] uses positions with step -1, so the rows come out as 5, 4, 3, 2, 1, 0.
3. So the answer is print(df.iloc[::-1]).
Teacher's Note:
1. df[::1] has step +1, so it just prints the rows in the normal order.
2. A DataFrame has no reverse() method, and adding two DataFrames with + adds their values instead of joining them.
(a)
df.last(3)(b)
df.bottom(3)(c)
df.next(3)(d)
df.tail(3)Show Answer & Explanation
Answer: (d) df.tail(3)
Explanation:
1. tail(n) returns the last n rows of a DataFrame.
2. So the answer is df.tail(3), which shows Jhelum, Ravi and Satluj.
Teacher's Note:
1. bottom() and next() are not DataFrame methods, and last() works only with date-based indexes.
2. head(3) would give the top 3 records in the same way.
x=df.columns[0] print(x)
(a)
0(b)
House(c)
First(d)
ErrorShow Answer & Explanation
Answer: (b) House
Explanation:
1. df.columns holds the column names: House, First, Second, Third.
2. Position 0 is the first column name, so x is the string 'House' and the output is House.
Teacher's Note:
1. A slice such as df.columns[:1] would print Index(['House'], dtype='object') instead of just the name.
2. df.columns gives column names, while df.index gives row labels.
(a)
print(df.size)(b)
print(df.shape)(c)
print(df.index)(d)
print(df.axes)Show Answer & Explanation
Answer: (a) print(df.size)
Explanation:
1. size gives the total number of elements in the DataFrame.
2. The DataFrame has 6 rows and 4 columns, so size = 6 x 4 = 24.
3. So the answer is print(df.size).
Teacher's Note:
1. df.shape prints (6, 4), the number of rows and columns.
2. df.index prints RangeIndex(start=0, stop=6, step=1) and df.axes prints both the row and column labels.
Case Study 4: Pushp, a student of Class XII, has been asked to create a pandas Series S1 as shown below.
a 100 b 200 c 300 d 400 e 500 dtype: int64
With reference to the above, answer the given questions.
b 200 c 300 dtype: int64
(a)
print(S1[:3])(b)
print(S1[0:3])(c)
print(S1[1:3])(d)
print(S1[2:4])Show Answer & Explanation
Answer: (c) print(S1[1:3])
Explanation:
1. The output has b and c, which are at positions 1 and 2 (positions start from 0).
2. A slice [1:3] includes position 1 and 2 but not 3.
3. So the answer is print(S1[1:3]).
Teacher's Note:
1. S1[:3] and S1[0:3] both give a, b and c; S1[2:4] gives c and d.
2. The stop position of a slice is never included.
(a)
print(S1[c])(b)
print(S1(c))(c)
print('S1' ['c'])(d)
print(S1 ['c'])Show Answer & Explanation
Answer: (d) print(S1 ['c'])
Explanation:
1. A label is given inside square brackets after the Series name, and a string label must be in quotes.
2. So the answer is print(S1 ['c']), which prints 300.
3. Options (a) and (b) give NameError (c without quotes) and option (c) indexes the string 'S1', not the Series (TypeError).
Teacher's Note:
1. The space between S1 and [ is allowed, though it is better not to leave one.
2. S1.loc['c'] gives the same value.
b 200 d 400 dtype: int64
(a)
print(S1.iloc[1:4])(b)
print(S1.iloc[2:4])(c)
print(S1.iloc(1:4))(d)
print(S1.iloc[1:4:2])Show Answer & Explanation
Answer: (d) print(S1.iloc[1:4:2])
Explanation:
1. b is at position 1 and d is at position 3, so every second element from position 1 is needed.
2. The slice start:stop:step = 1:4:2 gives positions 1 and 3.
3. So the answer is print(S1.iloc[1:4:2]).
Teacher's Note:
1. iloc[1:4] gives b, c, d and iloc[2:4] gives c, d; iloc(1:4) with round brackets is a syntax error.
2. The third number in a slice is the step.
(a)
print(S1 [+10])(b)
print(S1+10)(c)
print(S1)+10(d)
print(S1)+print(10)Show Answer & Explanation
Answer: (b) print(S1+10)
Explanation:
1. Adding a number to a Series adds it to every element.
2. S1+10 gives 110, 210, 310, 410, 510, and print() displays it.
3. So the answer is print(S1+10).
Teacher's Note:
1. In options (c) and (d) print() returns None, so adding to it gives a TypeError after S1 is printed unchanged.
2. S1[+10] tries to read position 10, which does not exist (IndexError).
(a)
S1=S1.drop(d)(b)
S1=S1.drop('d')(c)
S1=drop('d')(d)
S1=S1.drop['d']Show Answer & Explanation
Answer: (b) S1=S1.drop('d')
Explanation:
1. drop() is a Series method that takes the label to be removed, in quotes.
2. drop() returns a new Series, so it is stored back in S1.
3. So the answer is S1=S1.drop('d'), leaving a, b, c and e.
Teacher's Note:
1. drop(d) without quotes and drop('d') without S1. give NameError, and drop['d'] with square brackets gives TypeError.
2. Without S1= the original Series would stay unchanged.
Case Study 5: Zeenat has created the following DataFrame dataframe1 to keep track of the Rollno, Name, Marks1 and Marks2 of students of her class. The row indexes are the default values.
| Rollno | Name | Marks1 | Marks2 | |
|---|---|---|---|---|
| 0 | 1 | Swapnil Sharma | 30 | 50 |
| 1 | 2 | Raj Batra | 75 | 45 |
| 2 | 3 | Bhoomi Singh | 82 | 95 |
| 3 | 4 | Jay Gupta | 90 | 95 |
(a)
print(dataframe1[dataframe1['Rollno']==2])(b)
print(dataframe1['Rollno']==2)(c)
print(dataframe1[dataframe1.Rollno==2])(d) Both (a) and (c)
Show Answer & Explanation
Answer: (d) Both (a) and (c)
Explanation:
1. dataframe1['Rollno']==2 gives True only for the row with Rollno 2.
2. Putting this condition inside dataframe1[ ] keeps only that row (Raj Batra, 75, 45). This is boolean indexing.
3. dataframe1.Rollno is the same column written with dot notation, so (a) and (c) give the same result.
4. So the answer is Both (a) and (c).
Teacher's Note:
1. Option (b) prints only a column of True/False values, not the student's record.
2. Dot notation works only when the column name is a valid Python name without spaces.
(i) del dataframe1['Marks1']
(ii) dataframe1.pop('Marks1')
(iii) drop dataframe1['Marks1']
(iv) pop dataframe1['Marks1']Choose the correct option:(a) Both (i) and (ii)
(b) Only (ii)
(c) (i), (ii) and (iii)
(d) (i), (ii) and (iv)
Show Answer & Explanation
Answer: (a) Both (i) and (ii)
Explanation:
1. The 3rd column is Marks1 (after Rollno and Name).
2. (i) del dataframe1['Marks1'] deletes the column in place.
3. (ii) dataframe1.pop('Marks1') removes the column and returns it.
4. (iii) and (iv) are not valid Python statements (SyntaxError). So the answer is Both (i) and (ii).
Teacher's Note:
1. dataframe1.drop('Marks1', axis=1) also removes the column but returns a new DataFrame.
2. pop() is useful when the removed column is needed later.
(a)
print(dataframe1.shape)(b)
print(dataframe1.num)(c)
print(dataframe1.size)(d)
print(dataframe1.elements)Show Answer & Explanation
Answer: (c) print(dataframe1.size)
Explanation:
1. size gives the total number of elements = rows x columns.
2. Here it is 4 x 4 = 16, so the answer is print(dataframe1.size).
Teacher's Note:
1. shape prints (4, 4), the rows and columns separately.
2. num and elements are not DataFrame attributes, so they give an AttributeError.
(a)
dataframe1.column=[45,52,90,95](b)
dataframe1['Marks3']=[45,52,90,95](c)
dataframe1.loc['Marks3']=[45,52,90,95](d) Both (b) and (c) are correct
Show Answer & Explanation
Answer: (b) dataframe1['Marks3']=[45,52,90,95]
Explanation:
1. A new column is added by assigning a list to a new column name in square brackets.
2. The list has 4 values, one for each row, so dataframe1['Marks3']=[45,52,90,95] adds the column.
Teacher's Note:
1. dataframe1.loc['Marks3']=[...] adds a new row labelled Marks3, not a column.
2. dataframe1.column=[...] only creates a Python attribute and pandas warns that no column is added.
Case Study 6: Naman has created the following DataFrame Climate to record data about the climatic conditions of four years.
| Year | MaxTemp | MinTemp | Rainfall | |
|---|---|---|---|---|
| 0 | 2017 | 32 | 20 | 123 |
| 1 | 2018 | 33 | 22 | 140 |
| 2 | 2019 | 35 | 21 | 135 |
| 3 | 2020 | 34 | 23 | 160 |
(a)
Climate[['MaxTemp','Rainfall']][1:3](b)
Climate['MaxTemp', 'Rainfall'][1:3](c)
Climate.iloc[1:3](d)
Climate.iloc[1:3,1:2]Show Answer & Explanation
Answer: (a) Climate[['MaxTemp','Rainfall']][1:3]
Explanation:
1. 2018 and 2019 are in rows 1 and 2, so the row slice is [1:3].
2. Climate[['MaxTemp','Rainfall']] (a list of names in double brackets) selects the two columns.
3. So the answer is Climate[['MaxTemp','Rainfall']][1:3].
4. Option (b) gives KeyError, option (c) returns all four columns and option (d) returns only MaxTemp.
Teacher's Note:
1. A list of columns needs two pairs of brackets: one for indexing and one for the list.
2. Climate.iloc[1:3, [1,3]] would give the same two columns by position.
(a)
Climate=Climate["MaxTemp"]-Climate["MinTemp"](b)
print(Climate["maxt"]-Climate["mint"])(c)
print(Climate["MaxTemp"]-Climate["MinTemp"])(d)
print(Climate.Climate["MaxTemp"]-Climate["MinTemp"])Show Answer & Explanation
Answer: (c) print(Climate["MaxTemp"]-Climate["MinTemp"])
Explanation:
1. Subtracting one column from another subtracts the values row by row.
2. print(Climate["MaxTemp"]-Climate["MinTemp"]) prints 12, 11, 14 and 11.
Teacher's Note:
1. Option (a) displays nothing and replaces the whole DataFrame with the difference Series.
2. Column names are case-sensitive, so maxt and mint give a KeyError.
(a)
print(Climate.head()=2)(b)
print(Climate.head(n==2))(c)
print(Climate.head(range(2)))(d)
print(Climate.head(2))Show Answer & Explanation
Answer: (d) print(Climate.head(2))
Explanation:
1. head(n) returns the first n rows; the number goes inside the brackets.
2. So the answer is print(Climate.head(2)), showing the rows for 2017 and 2018.
Teacher's Note:
1. head(n=2) is also correct, but n==2 is a comparison and gives a NameError.
2. Without a number, head() returns the first 5 rows.
(a)
print(Climate.tail()=2)(b)
print(Climate.tail(n==2))(c)
print(Climate.tail(range(2)))(d)
print(Climate.tail(2))Show Answer & Explanation
Answer: (d) print(Climate.tail(2))
Explanation:
1. tail(n) returns the last n rows.
2. So the answer is print(Climate.tail(2)), showing the rows for 2019 and 2020.
Teacher's Note:
1. Writing tail()=2 inside print() is a SyntaxError because a function call cannot be assigned to.
2. tail() keeps the original row labels (2 and 3 here).
Case Study 7: The HR Department of ABCTech has created the following DataFrame to store data about salaries and bonus paid to their employees:
import pandas as pd
d1={'EName':['Kavita','Sudha','Garima'],'Sal':[50000,60000,55000],'Bonus':[3000,4000,5000]}
df1=pd.DataFrame(d1)| EName | Sal | Bonus | |
|---|---|---|---|
| 0 | Kavita | 50000 | 3000 |
| 1 | Sudha | 60000 | 4000 |
| 2 | Garima | 55000 | 5000 |
Choose the Python statement using suitable functions for the following tasks.
(a)
df1[:Sal :Bonus](b)
df1.loc(['Sal','Bonus'])(c)
df1.iloc(['Sal','Bonus'])(d)
df1[['Sal','Bonus']]Show Answer & Explanation
Answer: (d) df1[['Sal','Bonus']]
Explanation:
1. Several columns are selected by giving a list of their names inside the square brackets.
2. So the answer is df1[['Sal','Bonus']].
3. loc and iloc use square brackets, not round ones, so options (b) and (c) give TypeError; option (a) gives NameError.
Teacher's Note:
1. df1.loc[:, ['Sal','Bonus']] is another correct way to select the same columns.
2. iloc works with positions only, so it would need df1.iloc[:, [1,2]].
(a)
df1[df1.EName='Kavita'](b)
df1.loc[df1.EName=='Kavita'](c)
df1.iloc[df1.EName=='Kavita'](d)
df1[EName='Kavita']Show Answer & Explanation
Answer: (b) df1.loc[df1.EName=='Kavita']
Explanation:
1. Comparison uses ==; a single = is assignment and gives a SyntaxError in options (a) and (d).
2. df1.loc[condition] keeps the rows where the condition is True.
3. So the answer is df1.loc[df1.EName=='Kavita'].
Teacher's Note:
1. iloc does not accept a boolean Series as a condition, so option (c) gives an error.
2. df1[df1.EName=='Kavita'] without loc gives the same result.
(a)
df1.tail(1)(b)
df1.tail(-1)(c)
df1.head(n=1)(d)
df1.head()Show Answer & Explanation
Answer: (a) df1.tail(1)
Explanation:
1. tail(1) returns only the last row.
2. So the answer is df1.tail(1), which shows Garima.
Teacher's Note:
1. tail(-1) returns all rows except the first, and head(n=1) returns the first employee.
2. head() without a number returns up to 5 rows, so here it shows all three employees.
(a)
df1['Email']='abc@gmail.com'(b)
df1[Email]='abc@gmail.com'(c)
df1.loc['Email']='abc@gmail.com'(d)
df1('Email')='abc@gmail.com'Show Answer & Explanation
Answer: (a) df1['Email']='abc@gmail.com'
Explanation:
1. A new column is created by assigning to a new column name in square brackets.
2. A single value is copied into every row, so df1['Email']='abc@gmail.com' adds the column.
Teacher's Note:
1. df1.loc['Email']=... adds a new row labelled Email, not a column.
2. The column name must be in quotes, otherwise Python treats Email as a variable and gives a NameError.
(a)
df1.Sal>50000(b)
df1[df1.Sal>50000](c)
df1[df1.'Sal'>50000](d)
df1.iloc[df1.Sal>50000]Show Answer & Explanation
Answer: (b) df1[df1.Sal>50000]
Explanation:
1. df1.Sal>50000 gives True for Sudha (60000) and Garima (55000).
2. Putting the condition inside df1[ ] keeps only those rows, so the answer is df1[df1.Sal>50000].
3. Option (a) only shows True/False values, option (c) is a SyntaxError and option (d) gives an error because iloc does not take a boolean Series.
Teacher's Note:
1. Kavita earns exactly 50000, so she is not included because the condition is 'more than'.
2. Use >= when the value itself should also be included.
Free study material for Informatics Practices
Useful Resources and Notes for Class 12 Informatics Practices Data Handling using Pandas I
Essential Notes for Class 12 Informatics Practices
Explore essential learning tools for Class 12 Informatics Practices Data Handling using Pandas I. This curated collection features in-depth notes and targeted practice questions built around the active 2026 curriculum to streamline your daily revision.
Verified Solutions for Class 12 Informatics Practices
Designed around the official curriculum, these study guides guarantee standard compliance. Reviewing step-by-step solutions clarifies complex sub-topics within Data Handling using Pandas I and demystifies standard marking schemes for Informatics Practices evaluations.
Enhance Accuracy with Online Tests
Wrap up your chapter revision by testing your knowledge against standard objective question formats. Explore our full library of free, up-to-date sample papers and online assessments to secure top grades in your CBSE examinations.
FAQs
The latest 2026-27 advanced study resources for Class 12 Informatics Practices are available for free on StudiesToday.com which includes NCERT Exemplars, high-order thinking skills (HOTS) questions, and deep-dive concept summaries.
Our exhaustive Class 12 Informatics Practices package includes chapter wise revision notes, solved practice sheets, important formulas and Concept Maps to help in better understanding of all topics.
Yes. For Class 12, our resources have been developed to help you get better marks in CBSE school exams and also build fundamental strength needed for entrance tests including Competency Based learning.
in Class 12, students should use Active Recall method, read the concept summary, then solve the Important Questions section without looking at the answers and then check your answers.
All CBSE Informatics Practices study materials are provided in mobile-friendly PDF. You can download and save them on your device.
Yes, our team has ensured that all Informatics Practices materials for Class 12 are strictly aligned with the National Education Policy (NEP) 2020 and the latest 2026-27 CBSE syllabus.