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
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.
0 of 8 parts marked complete on this device.
Every part of this course is marked complete on this device. The capstone below is the victory lap - and the quiz will tell you if anything slipped.
- Build a Team Net-Rating Dashboard TablePer-100 ratings are the language; build the phrasebook.
- Draw an NBA Shot Chart with matplotlibEvery shot on a court you drew - the signature basketball chart.
- NBA Shooting by Zone: Build a Shot-Zone Efficiency TableEfficiency by zone: where points actually come from.
- Draw a League-Wide NBA Shot HeatmapZoom out to the whole league's shot diet.
- The Efficiency Landscape: Plotting Offensive vs. Defensive RatingOffense against defense on one plane - team identity at a glance.
- The Rise of the Three-Pointer: Two Decades of NBA Shot SelectionTwo decades of shot data show the revolution happening.
- Does Shooting More Threes Actually Win Games? Two Decades of EvidenceThe harder question: does taking more threes actually win?
- Build an Elo Rating System from ScratchRate 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…
Offensive rating minus defensive rating, both per 100 possessions - scoring margin with the pace removed.
2. Why per-possession instead of per-game?
A fast team scores more per game without being better per trip. Per-possession puts every team on the same denominator.
3. In Elo, beating a much weaker opponent…
Elo pays out on surprise. Expected wins move ratings barely at all; upsets move them a lot.
4. Effective field-goal percentage adjusts plain FG% for…
A made three scores 1.5 times a made two, so eFG% weights it 1.5x. Free throws and turnovers need still-wider stats.
5. League three-point attempt share rose for two decades while accuracy stayed roughly flat. That implies…
Three points times a flat percentage still beats two times a similar percentage from mid-range - the math, not the shooting, drove the revolution.
Where next: Machine Learning from Scratch · Randomness, Inference & Simulation.