Creating a series from array in pandas



First we want to create the list. Next we want to convert the list into array by using numpy concepts. Next we want to convert the array into pandas series by using pd.series in pandas concepts for that we want to import the pandas.








Example-1
import pandas as pd
import numpy as np

a = np.array([ "c", "r", "a", "z", "y"])
n = pd.Series(a)

print(n)



Output



0    c
1    r
2    a
3    z
4    y
dtype: object







Example-2
import pandas as pd
import numpy as np

a = np.array([ "c", "o", "d", "i", "n", "g"])

n = pd.Series(a)

print(n)



Output:



0    c
1    o
2    d
3    i
4    n
5    g
dtype: object