Skip to content

Guides

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 November 18, 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.

Or use the official client: pip install strikerapi

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 not charted for a match 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.

The data this uses

Every row above comes from Premier League shot location and xG data. The location, end point, outcome and body part of every Premier League shot charted since 2012-13, with our expected goals. REST or MCP.

More guides

The same guide for other sports

Rather ask Claude? 19 free Claude skills call these endpoints for you.

Start with 500 free credits every month

No card. REST or MCP.