English

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 - Informatics Practices

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)

The code still performs the same task: creating and displaying a Pandas Series with specified index labels.

shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×