Q. Find the error in following code fragment:


(a)

S2 = pd. Series( [101, 102, 102, 104] )

print(S2.index)

S2.index = [0, 1, 2, 3, 4, 5]

S2[5] = 220

print(52)


(b) S = pd. Series (2, 3, 4, 5, index = range (4) )

(c) S1 = pd. Series (1, 2, 3, 4, index = range (7))

(d) S2 = pd. Series ([1, 2, 3, 4], index = range (4) )


Answer =

(a) Length of series is not equal to length of index. There is no row of index 5
(b) The data not given in list tuple or dictionary
(c) The data not given in list tuple or dictionary
(d) No error

Post a Comment

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

Previous Post Next Post