What is Pandas Series?

import pandas as pd

a = [1, 7, 2]

myvar = pd.Series(a)

print(myvar)
0    1
1    7
2    2
dtype: int64

Pandas Series in the column of the table. It means one dimension array that store any type of data.

No label Series

print(myvar[0])

If there is no more to determine, value will be labeled with its index number. First value will have index 0, second value will have index 1, etc. This label also can be used to access certain value.

Label Series

import pandas as pd

a = [1, 7, 2]

myvar = pd.Series(a, index = ["x", "y", "z"])

print(myvar)
x    1
y    7
z    2
dtype: int64

With index argument, we can give name to our label.

Key Object/ Value as Series

import pandas as pd

calories = {"day1" : 420, "day2": 380, "day3": 390}

myvar = pd.Series(calories)
print(myvar)
day1    420
day2    380
day3    390
dtype: int64

We also can use key object/value such as dictionary when create series.

Implementation

Label and No label Series

import pandas as pd

a = [1, 7, 2]

myvar = pd.Series(a)

print(myvar)
0    1
1    7
2    2
dtype: int64