CBSE Class 12 Informatics Practices Question 162 of 167

Python Pandas — I — Question 16

Back to all questions
16
Question

Question 12

Write a program to create a Series object from an ndarray that stores characters from 'a' to 'g'.

Solution
import pandas as pd
import numpy as np
data = np.array(['a', 'b', 'c', 'd', 'e', 'f', 'g'])
S = pd.Series(data)
print(S)
Output
0    a
1    b
2    c
3    d
4    e
5    f
6    g
dtype: object
Answer