A Series is a one-dimensional labelled array — think of a single spreadsheet column. It has values (a NumPy array underneath) and an index (the row labels). Every DataFrame column is a Series.
Creating a Series
import pandas as pds = pd.Series([6.5, 8.0, 7.25], name="package")s.values # the underlying NumPy arrays.index # RangeIndex(start=0, stop=3)# Custom index — labels instead of positionss = pd.Series([6.5, 8.0], index=["Ana", "Ravi"])s["Ana"] # 6.5 — look up by label
Vectorised, like NumPy
A Series inherits NumPy's vectorised operations and boolean masking, but keeps its labels aligned:
s * 100000 # element-wise, index preserveds[s > 7] # boolean filters.mean(), s.max() # aggregations
Key takeaways
- 01A Series is a labelled 1-D array: values (a NumPy array) plus an index of row labels.
- 02Look up by label (s["Ana"]) or position; every DataFrame column is a Series.
- 03It supports vectorised maths and boolean masking like NumPy, keeping labels aligned.
- 04Label alignment is pandas' superpower over raw NumPy.
