Q. What will be the output produced by following code, considering the Series object S given above?


(a) print(S[1:1])

(b) print(S[0:1])

(c) print (S[0:2])

(d) S[0:2] = 12

print(S)

(e) print(S.index)

print(S.values)


Answer =

(a) Series([], dtype: int64)

(b)
pencil    20
dtype: int64

(c)
pencil       20
notebook0    33
dtype: int64

(d)
pencil       12
notebook0    12
scale        52
eraser       10
dtype: int64

(e)
>>> s.index
Index(['pencil', 'notebook0', 'scale', 'eraser'], dtype='object')

>>> s.values
array([12, 12, 52, 10], dtype=int64)

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post