Bill James's Pythagorean expectation says a team's share of wins can be estimated from runs scored and runs allowed. Football borrowed the idea with goals, but it has a problem baseball does not: draws. This post builds a small pandas pipeline that fits the formula on two complete seasons of the top five European leagues, adds one parameter for draws, and then lists the 2026/27 teams whose points total sits furthest from their goal record.
Source: our football database (SQLite, table football_matches), league matches of the Premier League, La Liga, Serie A, Bundesliga and Ligue 1 for 2024/25, 2025/26 and 2026/27 with a final score; current-season data up to 2 December 2026 (Bundesliga and Ligue 1 up to 29 November). 192 team-seasons in the fitting set, 96 teams in the current season.
The formula
The classic version:
share = GF^k / (GF^k + GA^k) expected points = 3 * matches * share With k = 2 this is the baseball original. Football needs a different k, and the 3 * matches part assumes every match hands out three points, which a draw does not (it gives two in total). So we will fit two versions: the raw one, and one that mixes the share with a "one point per match" floor.
Loading one row per team per match
import sqlite3 from itertools import product import numpy as np import pandas as pd DB = "betstats.db" LEAGUES = ("APL", "La Liga", "Serie A", "Bundesliga", "Ligue 1") con = sqlite3.connect(DB) m = pd.read_sql_query( """SELECT league, season, home_team, away_team, fthg, ftag FROM football_matches WHERE league IN (?, ?, ?, ?, ?) AND season IN ('2425', '2526', '2627') AND fthg IS NOT NULL""", con, params=LEAGUES) cols = ["league", "season", "team", "gf", "ga"] home = m.rename(columns={"home_team": "team", "fthg": "gf", "ftag": "ga"})[cols] away = m.rename(columns={"away_team": "team", "ftag": "gf", "fthg": "ga"})[cols] long = pd.concat([home, away], ignore_index=True) long["pts"] = np.select([long.gf > long.ga, long.gf == long.ga], [3, 1], 0) t = (long.groupby(["league", "season", "team"]) .agg(n=("pts", "size"), gf=("gf", "sum"), ga=("ga", "sum"), pts=("pts", "sum")) .reset_index()) The home/away rename trick turns one match row into two team rows, so every later step is a plain groupby.
Fitting k (and a draw term) with a grid search
Two parameters and a few hundred rows do not need an optimiser. A grid is fast, readable and impossible to get stuck in a local minimum:
def pyth_share(df, k): return df.gf**k / (df.gf**k + df.ga**k) def xpts(df, k, a): # a * (share of 3 points) + (1 - a) * (1 point per match) return a * 3 * df.n * pyth_share(df, k) + (1 - a) * df.n def rmse(df, k, a): return float(np.sqrt(((xpts(df, k, a) - df.pts) ** 2).mean())) hist = t[t.season.isin(["2425", "2526"])] ks = np.round(np.arange(1.0, 2.51, 0.05), 2) raw = min((rmse(hist, k, 1.0), k) for k in ks) print(f"raw formula: k={raw[1]}, RMSE={raw[0]:.2f} pts") best = min((rmse(hist, k, a), k, a) for k, a in product(ks, np.round(np.arange(0.70, 1.001, 0.01), 2))) err, K, A = best print(f"with draw term: k={K}, a={A}, RMSE={err:.2f} pts") Output:
raw formula: k=1.4, RMSE=5.58 pts with draw term: k=1.75, a=0.8, RMSE=4.12 pts Two things stand out. The raw formula prefers a low exponent, 1.4, because it is trying to squash every team towards the middle to compensate for the missing draws. Once the draw term is there, k moves up to 1.75 and the average error over a full season drops from 5.58 to 4.12 points. In plain terms, a = 0.8 says that about a fifth of the points model behaves like "one point per game, whatever happens".
Applying it to the current season
cur = t[t.season == "2627"].copy() cur["xpts"] = xpts(cur, K, A).round(1) cur["diff"] = (cur.pts - cur.xpts).round(1) cur = cur.sort_values("diff") show = ["league", "team", "n", "gf", "ga", "pts", "xpts", "diff"] print(cur[show].head(5).to_string(index=False)) print(cur[show].tail(5).to_string(index=False)) Below the line (fewer points than the goal record suggests):
league team n gf ga pts xpts diff APL Brentford 13 25 12 21 27.0 -6.0 APL Brighton 13 26 10 23 28.9 -5.9 Ligue 1 Le Havre 12 11 28 2 7.1 -5.1 La Liga Celta 14 12 14 13 17.3 -4.3 La Liga Malaga 14 12 28 5 9.0 -4.0 Above the line:
league team n gf ga pts xpts diff Serie A Cagliari 13 10 18 16 10.8 5.2 Serie A Lazio 13 30 10 35 29.8 5.2 La Liga Santander 14 23 33 20 14.5 5.5 Bundesliga Hamburg 11 10 24 13 6.9 6.1 La Liga Barcelona 15 58 17 42 35.2 6.8 The gaps line up with how the points were collected. Brentford have a +13 goal difference but six draws in 13 games; you can see their match-by-match record on the Brentford team page. Barcelona sit almost seven points above the curve because they have no draws at all: 14 wins and 1 defeat. A team that wins narrowly and loses heavily will always beat the formula; a team that wins big and draws often will trail it. The Barcelona team page shows the results behind that 42-point total.
Caveats worth keeping in the code comments
- Goal totals after 11–15 games are small. Hamburg's 10-24 goal record is a handful of matches away from looking very different.
- The fit is on full seasons. Applying it to partial seasons works because
nscales the output, but the error band is wider. - Leagues are pooled. A per-league
kis a one-line change (groupby("league")before the grid search) and a good next experiment. - This is a descriptive tool: it measures how points and goals relate so far, nothing more.
Analytics only, 18+.

