Which Pandas method is used to select a subset of rows and columns from a…
2026
Which Pandas method is used to select a subset of rows and columns from a DataFrame based on their integer-based position (index location) rather than labels?
- A.
.loc[]
- B.
.at[]
- C.
.iloc[]
- D.
.ix[]
Attempted by 113 students.
Show answer & explanation
Correct answer: C
The correct method for selecting rows and columns based on integer-based positions in Pandas is .iloc[]. Unlike .loc, which uses labels, .iloc specifically targets integer-location-based indexing.