DataFrame Operations and CSV Files Class 12 PYQs 2024–2026 with Solutions | CBSE Informatics Practices Skip to content
Smart Notes for Every Exam · instant PDF download after payment +91 92520 37565
Class 12 · Informatics Practices · Chapter 3

DataFrame Operations and CSV Files: Class 12 PYQs 2024–2026 with solutions

All 14 CBSE board questions asked from DataFrame Operations and CSV Files in 3 board papers, with the year, set and marks of each. 10 are solved free below. The Class 12 Informatics Practices PYQ Book: Solved Board Papers 2024-2026 (CBSE) has every solution, all chapters and 3 full board papers.

Cover of Class 12 Informatics Practices PYQ Book: Solved Board Papers 2024-2026 (CBSE)
Class 12 Informatics Practices PYQ book: every chapter + 3 board papers, all solved
US$1.99US$1.9934% off
Free sample

DataFrame Operations and CSV Files: board weightage

Board weightage 2024–2026

Year202420252026
Questions347
Marks8811

Most asked topics

Adding, renaming and deleting7
CSV import and export4
Indexing and selection3

14 questions from 3 papers. Repeated questions are shown once with every year they were asked.

Jump to: 1 mark2 marks3 marks4 marks5 marks

1 mark: MCQ and Assertion–Reason

Q1 · CBSE 2026 · 90 · Q21 mark

Add a new row to DataFrame DF using: (A) DF.add() (B) DF.loc[] (C) DF.loc() (D) DF.addloc[]

Solution

(B) DF.loc[], e.g. DF.loc['new'] = [...].

Q2 · CBSE 2026 · 90 · Q81 mark

What does print(df.loc['S2']) do?

Solution

(A) Displays the data of the row with label 'S2'.

Q3 · CBSE 2026 · 90 · Q121 mark

CSV stands for ____ Separated Values: (A) Colon (B) CTRL (C) Comma (D) Caret

Solution

(C) Comma.

Q4 · CBSE 2026 · 90 · Q181 mark

Value of axis to delete a column: (A) −1 (B) 0 (C) 1 (D) 2

Solution

(C) axis = 1.

Q5 · CBSE 2025 · 90 · Q171 mark

Statement to change a column label in DataFrame df: (A) df = df.rename({old_name : new_name}, axis='columns') (B) df.rename(old_name, new_name), axis='columns' (C) df.change_name(…) (D) df.update({…}, axis='bar')

Full step-by-step solution is in the PYQ book (US$1.99).
Q6 · CBSE 2025 · 90 · Q181 mark

DataFrame.____[ ] is used for label indexing: (A) label (B) index (C) labindex (D) loc

Full step-by-step solution is in the PYQ book (US$1.99).
Q7 · CBSE 2025 · 90 · Q201 mark

A–R. (A): drop() can delete rows and columns. (R): The axis parameter specifies rows (axis=0) or columns (axis=1).

Full step-by-step solution is in the PYQ book (US$1.99).
Q8 · CBSE 2024 · 90 · Q71 mark

Which is NOT true about CSV files? (i) values separated by commas (ii) to_csv() saves a DataFrame to CSV (iii) a CSV file is created using a word processor (iv) CSV is a type of text file

Full step-by-step solution is in the PYQ book (US$1.99).

2 marks: very short answer

Q9 · CBSE 2026 · 90 · Q22(B)2 marks

(b) Explain Boolean Indexing with respect to DataFrames, with an example.

Solution

Boolean indexing filters rows of a DataFrame using a condition; only rows where the condition is True are returned. Example: for df with Name [Ajay, Riya, David, Peter] and Age [25, 30, 35, 40], df[df['Age'] > 30] returns the rows of David and Peter.

Q10 · CBSE 2026 · 90 · Q36(II)2 marks

36 (II) Rename the row indexes of Scholarship to ['a','b','c','d','e']. (III) Remove the last row.

Solution

Scholarship.index = ['a', 'b', 'c', 'd', 'e']          # (II)
# or Scholarship = Scholarship.rename(index={0:'a',1:'b',2:'c',3:'d',4:'e'})
Scholarship = Scholarship.drop(Scholarship.index[-1]) # (III)
# or Scholarship = Scholarship.iloc[:-1]
Part (I) (creation with a dictionary of Series) is in Chapter 2.

3 marks: short answer

Q11 · CBSE 2026 · 90 · Q30(B)3 marks

(b) customer.csv (header Name, Age, City; rows Rudra 17 Kolkata, Divya 19 Dehradun, Nabeel 22 Lucknow): import into DataFrame DF and display the last two rows.

Solution

import pandas as pd
DF = pd.read_csv("customer.csv")
print(DF.tail(2))

     Name  Age      City
1 Divya 19 Dehradun
2 Nabeel 22 Lucknow

Q12 · CBSE 2024 · 90 · Q303 marks

DataFrame password (CodeName, Category, Frequency; rows 0–6: aaaaaa alpha 6.91, dragon animal 18.52, baseball sport 1.29, football sport 11.11, monkey animal 3.72, qwerty alpha 1.85, abcde alpha 3.19). (i) Add row abc123, alphanumeric, 12.8. (ii) Delete the row with label 2. (iii) Delete column Frequency.

Solution

password.loc[7] = ['abc123', 'alphanumeric', 12.8]
password.drop(2, inplace=True) # row label 2
password.drop('Frequency', axis=1, inplace=True)

   CodeName      Category
0 aaaaaa alpha
1 dragon animal
3 football sport
4 monkey animal
5 qwerty alpha
6 abcde alpha
7 abc123 alphanumeric

4 marks: SQL / case-based

Q13 · CBSE 2024 · 90 · Q324 marks

DataFrame result (a–d above). (i) Output of print(result.loc[:,'Attempts'] > 1) (ii) Display the last three records. (iii) Display records with row labels 'a' and 'd'. OR read 'registration.csv' into DataFrame regis.

Solution

(i) a False, b True, c True, d False (Name: Attempts, dtype: bool). (ii) print(result.tail(3)) (or result.iloc[1:]). (iii) print(result.loc[['a','d']]). OR regis = pd.read_csv("registration.csv").

5 marks: programs and case studies

Q14 · CBSE 2025 · 90 · Q365 marks

DataFrame Doctor (DID, NAME, DEPARTMENT, FEE; rows 0–4: 101 Dr. Joe ENT 1500, 102 Dr. Salma UROLOGY 1600, 103 Dr. Jeet ORTHO 1550, 104 Dr. Neha ENT 1200, 105 Dr. Vikram ORTHO 1700). (i) Print the last three rows. (ii) Display names of all doctors. (iii) Add column 'Discount' with 200 for all. (iv) Display rows with index 2 and 3. (v) Delete the column 'Department'.

Solution

print(Doctor.tail(3))                       # (i)
print(Doctor['NAME']) # (ii)
Doctor['Discount'] = 200 # (iii)
print(Doctor.loc[[2, 3]]) # (iv) or Doctor[2:4]
Doctor.drop(['DEPARTMENT'], axis=1, inplace=True) # (v)
(Use the column labels exactly as in the DataFrame.)

Get every solution for all chapters

  • Every board question of every chapter, each fully solved the way the board gives marks
  • 3 complete board papers, each followed by its solutions
  • Weightage and most-asked topics for every chapter
  • Instant PDF download, colour and black & white print copies
See real pages (free sample)

Revising the chapter first? Complete Informatics Practices Notes for Class 12 (CBSE 065, 2026-27) →

What you get in the pack

All chapters in this pack

  1. PYQ Ch 1 Pandas Series
  2. PYQ Ch 2 DataFrame: Creation and Attributes
  3. PYQ Ch 3 DataFrame Operations and CSV Files
  4. PYQ Ch 4 Data Visualisation with Matplotlib
  5. PYQ Ch 5 SQL Revision and Single-row Functions
  6. PYQ Ch 6 SQL Aggregates, Grouping and Joins
  7. PYQ Ch 7 Computer Networks
  8. PYQ Ch 8 Introduction to the Internet and Web
  9. PYQ Ch 9 Societal Impacts
  10. Board Paper 2026 Set 90 with Solutions
  11. Board Paper 2025 Set 90 with Solutions
  12. Board Paper 2024 Set 90 with Solutions
← PYQ Ch 2 DataFrame: Creation and Attributes PYQ Ch 4 Data Visualisation with Matplotlib →

Prices shown in US dollars. Show prices in: ₹ INR · US$ USD