Q. Find the error in the following code fragments:
(a)
S2 = pd. Series ([101, 102, 1-2, 104)]
print (S2.index)
S2.index = [0. 1. 2. 3, 4, 5].
S2 [5] = 220
print (S2)
(b) S = pd.Series (2, 3, 4, 55, index = range (4))
(c) S1 = pd.Series (1, 2, 3, 4, index = range (7))
(d) S2 = pd.Series ([1, 2, 3, 41, index = range (4))
Answer :-
(a) In line 3rd due to invalid syntax of list.
(b) The sequence must be in list.
(c) The sequence must be in list. And number of index is not equal to number of sequence.
(d) No error.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )