Pandas Series
A Series pairs one-dimensional values with index labels. Labels can identify observations independently of their current position in memory.
How it works
A Series has one dtype, a name and an index. Labels need not be integers and are not automatically guaranteed unique. Use an explicit dtype when missingness or representation matters. A label lookup and a positional lookup answer different questions, even when a default integer index initially makes them appear interchangeable. Later alignment operations use these labels to match values.
Run the code
Select Try in playground to load the complete editable source. Nothing executes until you choose Run. The browser uses Pyodide 0.27.7, Pandas 2.2.3 and NumPy 2.0.2. Each ordinary execution starts a fresh isolated runtime. The tables are fictional and do not use personal files.
For local work, use a separate virtual environment and run python series.py. Download the complete source. The reviewed local environment uses Python 3.12.14, Pandas 3.0.6 and NumPy 2.5.4; the browser uses Pyodide 0.27.7 with Pandas 2.2.3 and NumPy 2.0.2. Compatible examples are checked in both. See the environment setup. No Apache or database server is required.
Example
import pandas as pd
import numpy as np
kg = pd.Series([12., 8., 6.], index=["d101", "d102", "d103"], name="kg")
print(kg.name)
print(float(kg.loc["d102"]))
print(kg.index.tolist())
Expected result
kg 8.0 ['d101', 'd102', 'd103']
The label d102 selects the eight-kilogram observation. Reordering the Series would change positions without changing that identity. The name describes the value field; it does not establish a physical-unit validation rule.
Use Pandas’s official reference for precise contracts, supported versions and numerical limitations.