S

Shyam Dubey • 3.70K Points
Extraordinary

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: 3
  • Filed under category Pandas
  • Hashtags:

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.