Advertisements
Advertisements
Question
Write a Python program to create a Pandas Series as shown below using a ndarray, where the subject names are the indices and the corresponding marks are the values in the series.
| Mathematics | 85 |
| Science | 90 |
| English | 78 |
| History | 88 |
Code Writing
Advertisements
Solution
import pandas as pd
import numpy as np
marks = np.array([85, 90, 78, 88])
series = pd.Series(marks, index=['Mathematics', 'Science', 'English', 'History'])
print(series)shaalaa.com
Is there an error in this question or solution?
