MBOSE Class XII Informatics Practices · Chapter 2
Data Handling Using Pandas – I
Opening soonLearn to store, select and change data in Python with Pandas Series and DataFrames, and import data from files.
14 lessons · 56 practice questions · unit "Data Handling using Pandas and Data Visualisation" carries 25 marks
What this chapter covers
- Python libraries — NumPy, Pandas, Matplotlib
- Series — creation, accessing (indexing, slicing), attributes, methods, mathematical operations
- DataFrame — creation, adding/deleting rows and columns, renaming labels, accessing with loc, iloc, at, iat, boolean indexing, slicing, attributes, transpose
- Iterating
- Joining and concatenation
- Importing and exporting CSV files
- Series vs NumPy ndarray
Key terms
- Series
One-dimensional labelled array
- DataFrame
Two-dimensional labelled table of columns (Series)
- Index
Labels of the rows (or of a Series)
- loc
Access by labels
- iloc
Access by integer positions
- at / iat
Access one value by label / position
- NaN
"Not a Number" — a missing value
- Transpose
Swapping rows and columns (df.T)
- CSV
Comma-separated values text file
Important questions with answers
10 of the 56 questions on this chapter, solved.
Question 1 · Multiple choice · 1 mark
A Series is
- (a) a one-dimensional labelled array
- (b) a two-dimensional table
- (c) a list of lists
- (d) a function
Answer: (a) a one-dimensional labelled array
It holds values of one type with an index.
Question 2 · Multiple choice · 1 mark
When two Series with partly different labels are added, unmatched labels get
- (a) 0
- (b) an error
- (c) the first value
- (d) NaN
Answer: (d) NaN
Arithmetic aligns on the index.
Question 3 · Multiple choice · 1 mark
Which statement deletes column C?
- (a)
df.drop('C', axis=1) - (b)
df.drop('C', axis=0) - (c)
df.remove('C') - (d)
df.delete('C')
Answer: (a)
df.drop('C', axis=1)axis=1 for columns.
- (a)
Question 4 · Multiple choice · 1 mark
Which parameter makes a column the row index while reading?
- (a) index_col
- (b) index
- (c) col_index
- (d) label
Answer: (a) index_col
E.g.
index_col='Ename'.Question 5 · Assertion and reason · 1 mark
Assertion (A):
s * 2doubles each value of a Series.Reason (R): Operations on a Series are vectorised.
- (a) Both A and R are true, and R is the correct explanation of A.
- (b) Both A and R are true, but R is not the correct explanation of A.
- (c) A is true, but R is false.
- (d) A is false, but R is true.
Answer: (a) Both A and R are true, and R is the correct explanation of A.
They act on every element.
Question 6 · Short answer · 2 marks
Create a Series of the days in the first three months with labels Jan, Feb, Mar.
Answer
pd.Series([31, 28, 31], index=['Jan', 'Feb', 'Mar']).Question 7 · Short answer · 2 marks
Write a statement to save df to result.csv without row labels.
Answer
df.to_csv('result.csv', index=False).Question 8 · Short answer · 3 marks
Read only rows 1–10 of data.csv using the column Roll as index.
Answer
pd.read_csv('data.csv', nrows=10, index_col='Roll').Question 9 · Long answer · 5 marks
Explain the creation of a Series with examples and its attributes.
Answer
Section 1.2; Exercise Q5.
Question 10 · Long answer · 5 marks
Explain loc, iloc, at, iat and boolean indexing.
Answer
Section 1.3; Section 8.2 (HSSLC 2025, Q11(a) (second choice)).
Study the whole chapter
14 step-by-step lessons, all 56 practice questions with hints, flashcards and mock tests for MBOSE Class XII Informatics Practices.