Skip to content
Question 31 of 38

Q.State whether the following statement is True or False : In Pandas Series, the Positional index can be a string or an integer.

Tamil Nadu DgeCBSE Class XII Board 2026Subjective· 1mImportance★★★★★
82% · 31/38 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The statement is False. In Pandas, the positional index (iloc) is always integer-based, while a label index (loc) can be a string or an integer. The question confuses these two distinct indexing mechanisms.

The Concept: Two Kinds of Indexing in Pandas

Pandas Series have two completely separate indexing systems, and this is one of the most common sources of confusion for beginners.

Positional indexing refers to the physical position of an element in the Series — the 0th element, the 1st element, the 2nd element, and so on. This is always an integer, starting from 0, just like list indices in Python. You access positional indices using .iloc[].

Label indexing refers to the label you assign to each element when you create the Series. These labels can be anything — strings, integers, floats, even tuples. You access label indices using .loc[].

The trick in the question is that a label can be an integer. So if you have a Series with integer labels like {0: 'a', 1: 'b', 2: 'c'}, then series.loc[1] gives 'b' (using the label 1), while series.iloc[1] also gives 'b' (using the position 1). They happen to match, but they are fundamentally different mechanisms.

Watch out

Just because a label happens to be an integer does NOT make it a positional index. The positional index is always the integer position in the underlying data structure, regardless of what labels you assign.

Step-by-Step Reasoning

  1. Define the terms precisely.

    A positional index in Pandas refers to the integer location of an element in the underlying array, starting from 0. It is accessed via the .iloc[] accessor. This is always an integer — never a string.

  2. Understand what the question claims.

    The statement says: "In Pandas Series, the Positional index can be a string or an integer." This is claiming that .iloc[] accepts strings as valid positional indices.

  3. Test the claim.

    Consider a simple Series:

    import pandas as pd
    s = pd.Series([10, 20, 30], index=['a', 'b', 'c'])
    ``` …
    

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.