Skip to main contentSkip to solution

In data handling, pandas support ________ index values.

Solution

✅ Correct Option: 2

Pandas does not require index labels to be unique. A Series or DataFrame can have repeated index values, so selecting a repeated label with .loc returns all the rows that carry it. This is why the answer is "non-unique".

For example, pd.Series([10, 20, 30], index=['a', 'a', 'b']) is valid, and s['a'] returns both entries labelled a.


Option 1: it is a common misconception that the index must be unique like a primary key or a dictionary key. Pandas does not enforce this.

Option 3: index labels need not be of one type, and an index can mix integers and strings.

Keyboard Shortcuts

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