Series Index and Labels
Each Series value has a label. Use the index for lookups with [] or .loc, and positions with .iloc.
Example
import pandas as pd
import numpy as np
s = pd.Series([10, 20, 30], index=['a', 'b', 'c'])
print(s['b'])
print(s.loc['c'])
print(s.iloc[0])
print(s[['a', 'c']].tolist())Result
20 30 10 [10, 30]
Exercise
Get by position.
s.[0]
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.