KnowledgeBoat Logo
|

Informatics Practices

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

Python Pandas

4 Likes

Answer

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

Answered By

3 Likes


Related Questions