Creating a series from list in pandas



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








Example-1
import pandas as pd

l = [ "c", "r", "a", "z", "y"]

n = pd.Series(l)

print(n)


Output



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







Example-2
import pandas as pd

l = [ "c", "o", "d", "i", "n", "g"]

n = pd.Series(l)

print(n)


Output



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