CBSE Class 12 Informatics Practices
Question 9 of 167
Python Pandas — I — Question 9
Back to all questions 9
Question 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.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
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.