• Create Pandas Series with custom index using “Series” method of Pandas library and index parameter.

  • In this Pandas tutorial we are creating  a list of colors and using that list we create a pandas series. Pandas series objects have immense use in single column data like time series data and custom indexing makes data wrangling much easier.

# Imports 
import pandas as pd

# Let's create a series
color = ['Red', 'Blue', 'Green', 'Red', 'Yellow']

s = pd.Series(color)
0       Red
1      Blue
2     Green
3       Red
4    Yellow
dtype: object
s100 = pd.Series(color, index=[100,101,102,103,104])
100       Red
101      Blue
102     Green
103       Red
104    Yellow
dtype: object
# Get Index
Int64Index([100, 101, 102, 103, 104], dtype='int64')