Skip to content
Question 33 of 38

Q.What will be the output of the following code? import pandas as pd myser = pd.Series([0, 0, 0]) print(myser) (A) 0 0 0 0 0 0 (B) 0 1 0 1 0 2 (C) 0 0 1 0 2 0 (D) 0 0 1 1 2 2

Punjab PsebCBSE Class XII Board 2023MCQ· 1mImportance★★★★★
87% · 33/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 →

pd.Series([0, 0, 0]) prints each element as index value on its own line, giving 0 0, 1 0, 2 0 — reading straight across, that's 0 0 1 0 2 0, option (C).

Trace

import pandas as pd
myser = pd.Series([0, 0, 0])
print(myser)
  • pd.Series([0, 0, 0]) builds a 1-D labelled array from the list [0, 0, 0].
  • Since no index is supplied, pandas assigns the default RangeIndex: 0, 1, 2.
  • Each element keeps the value 0 from the input list.

So the Series looks like:

indexvalue
00
10
20

Actual output

0    0
1    0
2    0
dtype: int64
``` …

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.