Question:

State whether the following statement is True or False:

In Pandas Series, the Positional index can be a string or an integer.

Show Hint

Position is always counted with integers. Only the label index can be a string.
Updated On: Oct 20, 2026
  • True
  • False
  • Cannot be determined
  • None of the above
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Know the two kinds of index:
A Pandas Series has two ways to point to a value.
The positional index is the position of the value. It is always an integer and starts at 0.
The label index is the name given to the value. It can be a string or an integer.

Step 2: Test it with code:
s = pd.Series([10, 20, 30], index=['a', 'b', 'c'])
print(s.iloc[0])    # 10  (position 0)
print(s['a'])       # 10  (label 'a')
print(s.iloc['a'])  # TypeError

The run printed 10, 10 and then a TypeError. The position 0 works. The string 'a' fails as a position.

Step 3: Judge the statement:
The statement says the positional index can be a string or an integer.
Only the label index can be a string. The positional index must be an integer. So the statement is False.

Step 4: Check the options:
(1) True is wrong, as shown above.
(3) Cannot be determined is wrong, because the rule is fixed in Pandas.
(4) None of the above is wrong, because option (2) is right.

Final Answer:
The statement is False, option (2).
Was this answer helpful?
0
0