The main difference between loc and iloc is that:
-
A
loc works only on Series
-
B
iloc cannot select rows
-
C
loc uses labels while iloc uses integer positions
Correct answer
-
D
loc uses positions while iloc uses labels
Correct answer
C. loc uses labels while iloc uses integer positions
13 views
Explanation
loc selects by index label; iloc selects by integer position.
Reference
Asked in: NTS, PPSC IT, Interviews
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ