Free course · Intermediate · 8 parts · ~62 min

Basketball Analytics with the NBA API

Ratings tables, shot charts, zone efficiency, the three-point revolution — and an Elo system you build yourself.

Basketball analytics speaks a compact language — ORtg, DRtg, net rating, shot zones, effective field goal — and the fastest way to learn it is to compute it. Eight builds: a ratings dashboard, three kinds of shot chart, the efficiency landscape, two data-driven looks at the three-point era, and a from-scratch Elo rating system.

The two three-pointer tutorials are a deliberate pair: one shows the revolution happened, the other asks the harder question of whether shooting more threes actually wins games. They disagree more than you'd expect.

What you'll be able to do

  • Build an ORtg/DRtg/net-rating dashboard from real team data
  • Draw shot charts — player, zone table, league hexmap — on a court you render
  • Interrogate the three-point era with two independent analyses
  • Implement Elo and rate every team from raw results
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: Parts 1 and 5 first for vocabulary; the shot-chart trio next; the three-point pair and Elo close it. Two to three weeks.

  1. Build a Team Net-Rating Dashboard TableIntermediate · ~8 minPer-100 ratings are the language; build the phrasebook.
  2. Draw an NBA Shot Chart with matplotlibIntermediate · ~10 minEvery shot on a court you drew - the signature basketball chart.
  3. NBA Shooting by Zone: Build a Shot-Zone Efficiency TableIntermediate · ~8 minEfficiency by zone: where points actually come from.
  4. Draw a League-Wide NBA Shot HeatmapIntermediate · ~8 minZoom out to the whole league's shot diet.
  5. The Efficiency Landscape: Plotting Offensive vs. Defensive RatingIntermediate · ~5 minOffense against defense on one plane - team identity at a glance.
  6. The Rise of the Three-Pointer: Two Decades of NBA Shot SelectionAdvanced · ~7 minTwo decades of shot data show the revolution happening.
  7. Does Shooting More Threes Actually Win Games? Two Decades of EvidenceAdvanced · ~10 minThe harder question: does taking more threes actually win?
  8. Build an Elo Rating System from ScratchIntermediate · ~6 minRate every team from results alone, with an Elo you built.

Check yourself

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

1. Net rating is…

2. Why per-possession instead of per-game?

3. In Elo, beating a much weaker opponent…

4. Effective field-goal percentage adjusts plain FG% for…

5. League three-point attempt share rose for two decades while accuracy stayed roughly flat. That implies…

Where next: Machine Learning from Scratch · Randomness, Inference & Simulation.