English

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) - Informatics Practices

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.

MCQ
Assertion and Reasoning
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=0 removes rows
  • axis=1 removes columns

Therefore, both the assertion and the reason are true, and the reason correctly explains the assertion.

shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×