CBSE Class 12 Informatics Practices
Question 19 of 44
Data Handling using Pandas — Question 20
Back to all questionsThe error in the code fragment is that the length of the data list [1, 2, 3, 4, 5] does not match the length of the index range(4). Since there are only five data values, the index should have a length that matches the number of data values.
The corrected code is:
S1 = pd.Series([1, 2, 3, 4, 5], index = range(5))