Series in Python
A Series is a column: values plus an index that travels with them.
import pandas as pd
runs = pd.Series([91, 104, 88], index=["mon", "tue", "wed"], name="tpm")
print(runs)
print(runs["tue"], runs.iloc[0])
print(runs.mean().round(1), runs.max())
print(runs + pd.Series([1, 1], index=["mon", "wed"]))
How it works
- The index is the label, not just a position.
- Arithmetic aligns on the index, it does not zip by position.
dtypeis one type for the whole column.
Keywords and builtins used here
asprint
The run, in numbers
- Lines
- 8
- Characters to type
- 233
- Tokens
- 106
- Three-star pace
- 100 tpm
At the three-star pace of 100 tokens a minute, this run takes about 64 seconds.
Step 1 of 4 in Series & frames, step 1 of 26 in pandas.