Question:

Assertion (A) : The drop() method in Pandas can be used to delete rows and columns from a DataFrame.
Reason (R) : The axis parameter in the drop() method specifies whether to delete rows (axis=0) or columns (axis=1).

Show Hint

Use inplace=True if you want drop() to modify the DataFrame without returning a new one.
Updated On: Jul 14, 2025
  • Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
  • Both Assertion (A) and Reason (R) are True and Reason (R) is not the correct explanation for Assertion (A).
  • Assertion (A) is True and Reason (R) is False.
  • Assertion (A) is False, but Reason (R) is True.
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

In Pandas, the drop() method is commonly used to remove rows or columns from a DataFrame.
By default, drop() removes rows, but by setting the axis parameter, you can choose to remove columns instead.
If axis=0, it means rows will be dropped.
If axis=1, it means columns will be dropped.
For example, df.drop('row_label') will drop a row.
df.drop('column_name', axis=1) will drop a column.
Therefore, the Assertion is true.
The Reason correctly explains how the axis parameter controls what is dropped.
Hence, both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation for Assertion (A).
Was this answer helpful?
0
0

Questions Asked in CBSE CLASS XII exam

View More Questions