S

Sikhar Chaudhary • 5.88K Points
Tutor III

Q. What is the difference between loc and iloc in pandas?

  • (A) loc selects rows by index labels, iloc by integer position
  • (B) loc selects columns only, iloc selects rows only
  • (C) loc and iloc are identical
  • (D) loc selects integer positions, iloc selects labels
  • Correct Answer - Option(A)
  • Views: 131
  • Filed under category Pandas

Explanation by: Sikhar Chaudhary
loc uses labels for selection, while iloc uses integer-based indexing.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics