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


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

(b) print (S[: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
notebook    33
dtype: int64

(d)
pencil      12
notebook    12
scale       52
erasers     10
dtype: int64

(e)
Index(['pencil', 'notebook', 'scale', 'erasers'], dtype ='object')
array([12, 12, 52, 10], dtype = int64)

Post a Comment

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

Previous Post Next Post