How do I build a Premier League expected goals table in pandas?
Per-match goals, expected goals, shots, possession and passing for all 20 clubs, for or against, in one call.
Code verified October 10, 2026. One call to get_team_stats, 5 credits.
The call
Add team to get one club. Averages cover every final match in the season.
import requests
import pandas as pd
API_KEY = "YOUR_API_KEY"
resp = requests.post(
"https://mcp.strikerapi.com/v1/get_team_stats",
headers={"x-api-key": API_KEY},
json={
"season": 2025,
},
timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]
t = pd.DataFrame(data["teams"]).set_index("abbrev")
t["xg_diff"] = t["xg_for"] - t["xg_against"]
t["goal_diff"] = t["goals_for"] - t["goals_against"]
t["finishing"] = t["goals_for"] - t["xg_for"]
cols = ["games", "xg_for", "xg_against", "xg_diff", "goal_diff", "finishing", "possession_pct"]
print(t[cols].sort_values("xg_diff", ascending=False).round(2))
Replace YOUR_API_KEY with a key from your dashboard. Python needs requests and pandas (pip install requests pandas). JavaScript runs on Node 18 or newer, or in the browser.
What comes back
The data object of the response, trimmed to the first rows. Every field is real output from the run above.
{
"season": 2025,
"teams": [
{
"abbrev": "ARS",
"display_name": "Arsenal",
"games": 38,
"goals_for": 1.87,
"goals_against": 0.71,
"xg_for": 1.9,
"xg_against": 0.83,
"shots_for": 14.6,
"possession_pct": 56.2
},
{
"abbrev": "MNC",
"display_name": "Manchester City",
"games": 38,
"goals_for": 2.03,
"goals_against": 0.92,
"xg_for": 1.95,
"xg_against": 1.22,
"shots_for": 15.6,
"possession_pct": 60.5
},
"...18 more"
],
"count": 20,
"method": "Per-match averages over every final match in the season (league and cup stages alike). xG is ours, from located shots; null where a season has no located shots. Pass accuracy pools every pass. A stat ESPN did not chart is null, never 0."
}What to do next
- get_standings (2 credits). The league table with points, deductions and form, to set beside the xG table.
- get_shot_map (10 credits). Where one club's expected goals came from, shot by shot.
More guides
Start with 500 free credits
No card. REST or MCP.