Free course · Intermediate · 8 parts · ~66 min

Soccer Analytics with StatsBomb & xG

Pass maps, shot maps, heatmaps and pass networks from free pro event data — then a complete World Cup: scoring by stage and a Poisson scoreline model.

Soccer's analytics revolution runs on event data, and StatsBomb gives a professional-grade slice of it away free. This course builds the four canonical match visualizations — pass map, xG shot map, player heatmap, team pass network — then closes on a real tournament: the complete 2026 World Cup, all 104 matches bundled, first read stage by stage with a groupby, then turned into the classic Poisson scoreline model that grids every possible final score with a probability.

An xG league table from Understat data rounds out the toolkit — the single most useful number for judging whether a team's results are sustainable. And because this course leans on xG so hard, it also audits it: one build checks StatsBomb's own numbers against every shot of a World Cup before asking you to trust them.

What you'll be able to do

  • Navigate StatsBomb event data and know what's in it
  • Draw pass maps, shot maps and heatmaps on a properly scaled pitch
  • Build a team pass network and read its structure
  • Construct an xG table and argue from it
  • Audit a published xG model's calibration with Wilson intervals and a Brier score
  • Fit a Poisson scoreline model and turn a fixture into win/draw/loss odds
Download the course bundle - every script + dataset, one ZIP

The bundle contains each part's finished script, the shared helpers, and the sample data they read, with a README listing the run order - the whole course works offline.

The syllabus

Pace: In order for the first two parts, then free order. The two World Cup parts are the payoff - a real tournament in your hands; take them last, in order.

  1. Build an xG League Table from Understat DataIntermediate · ~8 minxG against the table: the sustainability check every result needs.
  2. Draw a Pass Map with mplsoccerIntermediate · ~7 minEvent data made visible - your first professional-grade match graphic.
  3. Build a Match Shot Map with Expected GoalsIntermediate · ~8 minChance quality on the pitch map, not just the scoreline.
  4. Is xG Calibrated? Checking a Published Model Against 1,494 Real ShotsIntermediate · ~7 minThe audit: does 0.10 xG really mean 10%? A whole World Cup, checked.
  5. Draw a Player Heatmap from Event DataIntermediate · ~7 minWhere a player actually operated, from raw event coordinates.
  6. Build a Team Pass NetworkAdvanced · ~9 minTeam structure as a graph - who really connects the play.
  7. Group vs Knockout Scoring at the 2026 World Cup, with groupbyBeginner · ~6 minThe complete 2026 World Cup, one groupby, a real finding.
  8. Predict a Scoreline with Poisson: the World Cup Final as a GridIntermediate · ~14 minThe finale: a model that gave the final's exact score a 30% chance.

Check yourself

Five questions, graded on the page, nothing recorded anywhere - pick an answer and the explanation appears.

1. Expected goals (xG) measures…

2. A team running far ahead of its xG for several matches is…

3. In a pass network, node size and edge thickness typically encode…

4. StatsBomb open data is…

5. How does a team win 1-0 while 'losing' the xG battle?

Where next: Statistics for Sports Data · Sports Data Visualization.