The code still performs the same task: creating and displaying a Pandas Series with specified index labels.
Advertisements
Advertisements
Question
Rohit is trying to create a Pandas Series from scalar values. His code has some mistakes. Rewrite the correct code and underline the corrections made.
import pandas
data = [50, 15, 40]
series = pd.series(data, Index=[‘x’, ‘y’, ‘z’])
Print(series)
Code Writing
Advertisements
Solution
import pandas as pd
data = [50,15,40]
series = pd.Series(data, index=[‘x’, ‘y’, ‘z’])
print (series)
shaalaa.com
Is there an error in this question or solution?
