CBSE Class 12 Informatics Practices Question 17 of 44

Data Handling using Pandas — Question 18

Back to all questions
18
Question

Question 17(b)

Find the error in the following code fragments:

S = pd.Series(2, 3, 4, 55, index = range (4))
Answer

In the above code fragment, the data values should be enclosed in square brackets [] to form a list.

The corrected code is:

S = pd.Series([2, 3, 4, 55], index = range(4))