KnowledgeBoat Logo
|

Informatics Practices

Assertion. .loc() is a label based data selecting method to select a specific row(s) or column(s) which we want to select.

Reason. .iloc() can not be used with default indices if customized indices are provided.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Pandas

3 Likes

Answer

A is true but R is false.

Explanation
The .loc() is a label-based method in Pandas used for selecting specific rows or columns based on their labels (indices). While .iloc() can be used with default indices (0-based integer indices) even if customized indices are provided. .iloc[] is primarily used for integer-location based indexing.

Answered By

3 Likes


Related Questions