Informatics Practices
Find the error in the following code fragments:
S = pd.Series(2, 3, 4, 55, index = range (4))
Python Data Handling
1 Like
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))
Answered By
3 Likes
Related Questions
Write a program to iterate and print a dataframe row-wise at a time and print only first five rows.
Find the error in the following code fragments:
S2 = pd.Series([101, 102, 1-2, 104]) print (S2.index) S2.index = [0.1.2.3, 4, 5] S2[5] = 220 print (S2)Find the error in following code fragment
S1 = pd.Series(1, 2, 3, 4, index = range(7))Find the error in the following code fragments:
S2 = pd.Series([1, 2, 3, 4, 5], index = range(4))