Advertisements
Advertisements
प्रश्न
Write a Python program to create a Pandas Series as shown below from an ndarray containing the numbers 10, 20, 30, 40, 50 with corresponding indices ‘A’, ‘B’, ‘C’, ‘D’, ‘E’.
| A | 10 |
| B | 20 |
| C | 30 |
| D | 40 |
| E | 50 |
कोड लेखन
Advertisements
उत्तर
import pandas as pd
import numpy as np
data = np.array([10, 20, 30, 40, 50])
indices = ['A', 'B', 'C', 'D', 'E']
series = pd.Series(data, index=indices)
print(series)shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
