How to Build an NBA Statistics Dashboard
Pull data from nba_api, Basketball-Reference within its terms, or a licensed API, store it locally, and present it with Streamlit or Dash in Python or a BI tool. Show pace-adjusted ratings, the four factors and rolling form rather than raw averages, cache aggressively, and fetch on a schedule to stay within rate limits.
What the video built
The video, posted on 16 November 2026 and just over four minutes long, is a student project presentation of an interactive NBA team performance dashboard. Its author built it with Python, Streamlit, Plotly and pandas on team game data, with sidebar filters for season (2010 to 2024) and team. Four charts share those filters: a bar chart of average points by team, a chart of scoring against rebounding split by wins and losses, a line chart of how average team scoring changed over time, and a Sankey diagram showing flow between teams, game results and scoring categories. A final tab documents the dataset's source, licence, columns and limitations.
That last tab is the detail worth copying. A dashboard that states where its numbers come from and what they cannot show is more trustworthy than a prettier one that does not. The rest of this guide covers the decisions behind a build like this: data source, stack, metrics, and caching.
Choose the data source first
The source decides what the dashboard can show, how fresh it is, and whether you are allowed to publish it.
nba_api and the NBA.com stats endpoints
The open-source nba_api package describes itself as a Python client for the APIs behind NBA.com. It covers stats.nba.com endpoints such as game logs, box scores, shot charts and standings, plus live feeds for scoreboards and play-by-play, and returns pandas DataFrames. Its README is direct about the limits: the project is not affiliated with the NBA, the data is subject to NBA.com's terms of use, and the stats site throttles rapid requests and often does not respond to cloud IP ranges such as AWS, GCP, Azure and Colab. That last point matters for deployment, since a dashboard that works on a laptop can fail silently once hosted.
Basketball-Reference
Basketball-Reference has decades of clean historical tables and is the natural source for long-run franchise or player views. Sports Reference's bot-traffic policy says it blocks sessions that exceed about twenty requests a minute, and its data-use page says building tools or websites from scraped data requires permission. For a personal project, download what you need slowly and once. For anything public, ask first or use another source.
Commercial APIs
A licensed provider costs money and removes two problems: the terms state what you may display, and the feed comes with a schema and support. If the dashboard is a product rather than a portfolio piece, this is usually where it ends up. The guide to choosing an NBA data source compares the layers available and how reliable each route is.
Pick a stack by audience
Streamlit. The fastest route from a pandas notebook to a shareable app. Scripts rerun top to bottom on each interaction, widgets are one line each, and Plotly charts drop in directly. It suits exactly the kind of project in the video: a handful of filters driving several linked charts.
Dash. Plotly's framework uses explicit callbacks that connect inputs to outputs. More code than Streamlit, but finer control over layout and over which components update, which helps once a dashboard has many interacting views.
BI tools. Power BI, Tableau or Looker Studio suit teams that already use them and want non-programmers to edit views. Pull and clean data in Python, write it to a database or flat file, and let the tool handle presentation. The trade-off is less control over custom charts such as shot maps.
Whichever you pick, separate collection from presentation. A scheduled script fetches data and writes it to Parquet or a database; the dashboard only reads stored files. The Python sports analytics guide covers that layout in more depth.
Metrics worth showing
Raw per-game averages are the default and the weakest choice, because NBA teams play at different speeds.
Pace-adjusted ratings. Offensive and defensive rating, points scored and allowed per 100 possessions, compare teams fairly. Net rating, the difference between them, is the single best summary of team strength in a public dashboard.
The four factors. Effective field goal percentage, turnover rate, offensive rebound rate and free throw rate, on both sides of the ball. They explain why a rating is what it is.
Shooting profile. Shot share and efficiency by zone: rim, mid-range, corner three, above-the-break three. A shot chart is the obvious visual, but bin it coarsely, since small zones on small samples produce misleading hot spots.
Rolling form. Ten-game rolling net rating shows trend without single-game noise. Mark injuries and trades on the timeline so a viewer can see why form changed.
Player usage and minutes. For player views, usage rate and minutes share explain more about future output than points per game.
Show sample size beside every rate. A filter that narrows to one team in one month produces numbers that look precise and are not.
Caching, rate limits and refresh
Hitting the source on every widget change is how a dashboard gets slow and gets blocked.
Cache at two levels. Persist raw responses to disk with the retrieval date, so history never needs refetching. Then cache transformed DataFrames in the app. Streamlit's documentation recommends st.cache_data for computations that return data and st.cache_resource for shared objects such as database connections; its ttl parameter sets how long a cached value lives, which is how you get fresh scores without refetching completed seasons.
Throttle collection. Add a pause between requests, retry with backoff on timeouts, and fetch only what changed: today's games, not the whole season.
Refresh on a schedule. Completed seasons never change, so fetch them once. Current-season tables can refresh nightly; live scores need a short ttl or a separate live feed.
Adding market data
Many NBA dashboards eventually want a betting market view: how closing lines compare with results, or how a team's net rating relates to its spread. That requires odds and results on the same game keys as the stats. Parlay Ledger's REST API serves real-time and historical odds, game results and player statistics in a unified format, which suits a dashboard tab that sets model ratings beside market prices. Present it as data, not picks: show where the market and a rating disagree, and leave the interpretation to the reader.
Frequently asked questions
- What is the best Python library for an NBA dashboard?
- Streamlit is the quickest way to turn pandas code into an interactive app, and pairs well with Plotly charts. Dash gives finer control through explicit callbacks and suits larger dashboards. For data, nba_api wraps the NBA.com stats endpoints. The build in the video used Streamlit, Plotly and pandas on stored team game data.
- Why does nba_api stop working when the dashboard is deployed?
- The nba_api README notes that stats.nba.com throttles rapid requests and often does not respond to cloud IP ranges such as AWS, GCP and Azure. A dashboard that works locally may time out once hosted. Fetch data on a schedule from a machine that can reach the site, store it, and have the hosted app read stored files.
- Can you use Basketball-Reference data in a public dashboard?
- Proceed carefully. Sports Reference blocks sessions that exceed about twenty requests a minute, and its data-use page says building tools or websites from scraped data requires permission. Individual facts are not copyrightable, but bulk collection and republishing fall under its terms. For a public dashboard, ask for permission or use a licensed source.
- Which NBA metrics should a team dashboard show?
- Pace-adjusted offensive, defensive and net rating per 100 possessions, the four factors on both ends, shot profile by zone, and rolling form over about ten games. Show sample size beside each rate, and annotate injuries and trades so changes in form have visible context.