Guide
NFL EPA per play team rankings in Python
Short answer: pull every pass and run for each team from EndzoneAPI's get_plays, average the epa column by offense and by defense, and sort. For 2026 through week 13, San Francisco led offenses at 0.186 EPA per play and Jacksonville led defenses at -0.091 allowed. The defensive ranks are far noisier than the offensive ones.
Expected points added, or EPA, is the standard single number for how well a unit moves the ball. This guide ranks all 32 teams, adjusts for opponent strength, and measures how much of the ranking is signal. It describes team performance. It says nothing about wagering.
What the data gives you
get_plays returns play-by-play from 1999 on with epa, wpa, wp, success, down, distance, field position and the offense and defense codes. It costs 10 credits per call and returns up to 1,000 plays a page. Every play carries both posteam (the offense) and defteam (the defense). That matters for the cost of the job: you only need to pull each team's offense to get every team's defense too, because each play is one team's offense and another team's defense.
The response also carries a summary with epa_per_play and success_rate over every play the filter matched. For Kansas City's 424 pass plays in 2026 it reported 0.173 EPA per play and a 0.507 success rate. That is a convenient check on your own averages, and a cheap way to rank one team without downloading rows. To rank all 32 and to adjust for opponents, you need the rows.
Seasons are named by the year they start. The 2026 season began in September, and at the time of the run weeks 1 to 13 were complete, with 180 games played. Week 5 is a bye for Kansas City, so its weeks run 1 to 4, then 6 to 13.
Step 1: pull every pass and run
A team's season includes kickoffs, punts and kicks as well as snaps from scrimmage. EPA rankings normally cover only pass and run plays, so filter with play_type. Each team then needs two calls, one for passes and one for runs, and each fits on a single page. The script below does 64 calls for 32 teams and keeps only the columns it needs. That is 640 credits. The API replied with HTTP 429 on our first attempt because the calls came back to back, so the helper backs off and retries.
import json, os, time, urllib.error, urllib.request, pandas as pd
KEY = os.environ["ENDZONEAPI_API_KEY"]
def post(tool, body):
req = urllib.request.Request(f"https://mcp.endzoneapi.com/v1/{tool}", data=json.dumps(body).encode(),
headers={"Content-Type": "application/json", "x-api-key": KEY})
for wait in (2, 5, 10, 20, 40): # back off on HTTP 429
try:
with urllib.request.urlopen(req, timeout=90) as r:
return json.load(r)["data"]
except urllib.error.HTTPError as e:
if e.code != 429:
raise
time.sleep(wait)
raise RuntimeError("still rate limited")
teams = [t["abbrev"] for t in post("list_teams", {})["teams"]]
cols = ["game_id", "week", "posteam", "defteam", "play_type", "epa", "success", "qtr", "down", "score_differential", "wp"]
rows = []
for team in teams:
for play_type in ("pass", "run"):
offset = 0
while offset is not None:
page = post("get_plays", {"season": 2026, "posteam": team, "play_type": play_type,
"limit": 1000, "offset": offset})
rows += [{c: p.get(c) for c in cols} for p in page["plays"]]
offset = page.get("next_offset")
df = pd.DataFrame(rows)
df.to_csv("nfl_plays_2026.csv", index=False)
print(len(df), df.posteam.nunique(), df.week.max())The run returned 22,098 plays across 32 teams and 180 games, through week 13. Only rows with a non-null epa were kept for the analysis.
Step 2: raw offense and defense ranks
The first pass is a group-by. Average epa by posteam for offense, and by defteam for defense. For defense a lower number is better, because the average counts what the opposing offense gained.
The script then does three more things. It splits offense into passing and rushing. It fits an opponent-adjusted model. And it measures reliability by comparing odd weeks with even weeks. Read the output top to bottom.
import warnings; warnings.filterwarnings("ignore")
import numpy as np, pandas as pd
from sklearn.linear_model import Ridge
df = pd.read_csv("nfl_plays_2026.csv").dropna(subset=["epa"])
print(len(df), "plays,", df.game_id.nunique(), "games, weeks", df.week.min(), "to", df.week.max())
off = df.groupby("posteam").epa.agg(off_epa="mean", plays="size")
dfn = df.groupby("defteam").epa.mean().rename("def_epa_allowed") # lower is better
tbl = off.join(dfn)
tbl["off_rank"] = tbl.off_epa.rank(ascending=False).astype(int)
tbl["def_rank"] = tbl.def_epa_allowed.rank().astype(int)
print(tbl.sort_values("off_epa", ascending=False).round(3).head(5))
print(tbl.sort_values("def_epa_allowed").round(3).head(5))
print("league mean EPA/play", round(df.epa.mean(), 4))
# Split by pass and run.
split = df.pivot_table(index="posteam", columns="play_type", values="epa", aggfunc="mean").round(3)
print(split.sort_values("pass", ascending=False).head(3))
# Opponent-adjusted: one ridge model, an offense dummy and a defense dummy per team.
teams = sorted(set(df.posteam) | set(df.defteam))
def design(d):
X = np.zeros((len(d), 2 * len(teams)))
idx = {t: i for i, t in enumerate(teams)}
X[np.arange(len(d)), d.posteam.map(idx)] = 1
X[np.arange(len(d)), len(teams) + d.defteam.map(idx).values] = -1 # a good defense lowers EPA
return X
m = Ridge(alpha=50).fit(design(df), df.epa)
adj = pd.DataFrame({"adj_off": m.coef_[:len(teams)], "adj_def": m.coef_[len(teams):]}, index=teams)
tbl = tbl.join(adj)
tbl["adj_off_rank"] = tbl.adj_off.rank(ascending=False).astype(int)
print(tbl[["off_epa", "off_rank", "adj_off", "adj_off_rank"]].sort_values("off_rank").round(3).head(6))
print("rank corr raw vs adjusted (offense):", round(tbl.off_rank.corr(tbl.adj_off_rank, method="spearman"), 3))
# Reliability: do odd-week rankings predict even-week rankings?
a = df[df.week % 2 == 1].groupby("posteam").epa.mean()
b = df[df.week % 2 == 0].groupby("posteam").epa.mean()
print("odd vs even weeks, offense:", round(a.corr(b, method="spearman"), 3))
a = df[df.week % 2 == 1].groupby("defteam").epa.mean()
b = df[df.week % 2 == 0].groupby("defteam").epa.mean()
print("odd vs even weeks, defense:", round(a.corr(b, method="spearman"), 3))
# Noise: bootstrap one team's EPA/play over games.
rng = np.random.default_rng(1)
t = df[df.posteam == tbl.off_epa.idxmax()].groupby("game_id").epa.agg(["sum", "size"])
bs = [ (lambda s: s["sum"].sum()/s["size"].sum())(t.iloc[rng.integers(0, len(t), len(t))]) for _ in range(2000)]
print(tbl.off_epa.idxmax(), "95% interval", np.percentile(bs, [2.5, 97.5]).round(3))The league mean was 0.0097 EPA per play, near zero as it should be when every play is someone's offense. The best raw offenses were San Francisco (0.186), Cincinnati (0.139), Detroit (0.136), Dallas (0.131) and Kansas City (0.125). The best raw defenses by EPA allowed were Jacksonville (-0.091), Kansas City (-0.086), the Rams (-0.082), Minnesota (-0.075) and Seattle (-0.074). The worst offense was the Chargers at -0.147, and the worst defense by this measure was Tennessee at 0.125.
The pass and run split is informative. San Francisco's pass offense averaged 0.271 and its run offense 0.091. Cincinnati's pass offense averaged 0.234 while its run offense sat at -0.030. Across the league passes averaged 0.020 EPA per play and runs averaged -0.004, and 18 of 32 teams were better passing than running, so the split is worth looking at team by team.
Step 3: adjust for opponents
Raw averages reward teams that faced soft schedules. One way to correct that is a ridge regression on all 22,098 plays with one coefficient for each offense and one for each defense. The offense column is +1 for the team on offense and the defense column is -1 for the team on defense, so a strong defense gets a positive coefficient, meaning it lowers the EPA an average offense would produce. Ridge, with alpha set to 50, pulls extreme coefficients toward zero and keeps a team with a hot month from dominating.
After adjustment, San Francisco still leads at 0.176, then Cincinnati (0.129) and Detroit (0.127). Dallas and Kansas City swap fourth and fifth. The rank correlation between raw and adjusted offense is 0.976. Opponent adjustment moves little this deep into a season, because most teams have played a similar spread of opponents. It is more useful early in a year, when schedules are lopsided, and in college football, where schedules differ far more.
A few mid-table teams do move. Las Vegas is 18th on raw offense and 13th adjusted, while the New York Giants slide from 14th to 17th. Treat moves of that size as a prompt to look at the schedule, not as a verdict.
How much of the ranking is signal
Rankings feel precise, so test them. Split the season into odd and even weeks, rank teams on each half, and correlate the two rankings with Spearman's method.
| Unit | Odd vs even weeks, rank correlation |
|---|---|
| Offense | 0.619 |
| Defense | 0.277 |
Offense is moderately stable. Defense is mostly noise over six or seven games per half. That fits what most analysts see: offensive EPA carries more of a team's identity, largely because of the quarterback, and defensive EPA depends heavily on turnovers and the offense it faced.
A bootstrap puts a number on one team. Resampling San Francisco's games with replacement gives a 95 percent interval of 0.087 to 0.296 around its 0.186. The best offense in the league has an interval that reaches down to Detroit's raw number and up past anything else. That is what 13 games and 642 plays can tell you.
Using the rankings well
Report the rank and the interval, not the rank alone. Group defenses into tiers, such as top ten, middle and bottom ten, rather than pretending the difference between 12th and 14th means something. If you need a sharper read on one unit, split by situation: first-down passes, early downs only, or plays when the game is within one score. get_plays carries down, qtr, score_differential and wp for exactly that. Filtering to a win probability band with min_wp and max_wp removes garbage time cheaply, before you pull the rows.
Limits
- Thirteen weeks is short. The offense ranks correlate 0.62 between halves and the defense ranks 0.28. Expect rank swings of five places or more by season's end.
- Pass and run only. Kickoffs, punts, field goals, spikes and kneels are excluded. A team's special teams and game management do not show up.
- Garbage time is included. A team trailing by three scores throws more and gets different EPA. Use
min_wpandmax_wpto trim it. - Opponent adjustment is simple. One ridge model with no home-field term, no injuries and no quarterback changes. It is a sanity check, not a power rating.
- EPA is a model. It depends on an expected-points curve, and teams that play in extreme weather or with a backup quarterback do not match the average the curve assumes.
Live from the API
Free to embed on your own site, with no key needed. Get the embed code.
Get a free key Or download whole seasons as Parquet
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.