Skip to main contentSkip to solution

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

✅ Correct Option: 1

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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question