Advertisements
Advertisements
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).
Options
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.
Advertisements
Solution
Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
Explanation:
In Pandas, the drop() method is used to remove rows or columns from a DataFrame. The axis parameter specifies what is deleted:
axis=0removes rowsaxis=1removes columns
Therefore, both the assertion and the reason are true, and the reason correctly explains the assertion.
