Which of the following are valid types of index in the context of Python?
A. Positional Index
B. Dictionary Index
C. Series Index
D. Labelled Index
Which of the following are valid types of index in the context of Python?
A. Positional Index
B. Dictionary Index
C. Series Index
D. Labelled Index
Solution
Pandas uses two types of index to access data. A positional index is the default integer position, running 0, 1, 2, ... and used with iloc. A labelled index is a user-defined label such as a name or date, used with loc. So A and D are the valid types.
Dictionary Index: a dictionary is accessed through keys, and "dictionary index" is not an index type.
Series Index: a Series has an index, but "Series index" names the object it belongs to, not a type of index.
Remember: iloc is for position and loc is for label.
Related questions:
2025: 30 May Shift 2
2026: 13 May Shift 2
2025: 22 May Shift 1
2026: 21 May Shift 1