A baseline is a reference value or line that makes comparison immediate. Subtracting a starting value exposes change, while a horizontal threshold shows which results exceed a target. section 3.3.1 section 4.5.2
Use a baseline in two practical ways:
- Normalize a time series by calculating each value’s difference from a chosen starting point, such as population in 1960. section 3.3.1
- Add a horizontal reference line, such as 50% improvement, to show which categories outperform a decision threshold. section 4.5.2
Two kinds of comparison
For population trends, select the 1960 row, retrieve each series’ baseline value, and subtract it from every later value. For sports performance, add a red rule at y=50; bars above the line visibly exceed the baseline. section 3.3.1 section 4.5.2
Listing 3.27 Calculating the difference
baseline = df_melt[df_melt['Year'] == 1960]
continents = ['North America', 'World']
for continent in continents:
baseline_value = baseline[baseline['Continent'] == continent]['Population'].values[0]
m = df_melt['Continent'] == continent
df_melt.loc[m, 'Diff'] = df_melt.loc[m,'Population'] - baseline_value
Inspect the calculation that selects 1960 values and writes each series’ difference into a new Diff column. section 3.3.1















