Skip to content

Guides

How do I compare NBA team pace and efficiency in pandas?

Pace, offensive and defensive rating, net rating and the four factors for all 30 teams in one call, ready to sort and plot.

Code verified October 10, 2026. One call to get_team_stats, 5 credits.

The call

Add season_type or team to narrow it.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.dunkapi.com/v1/get_team_stats",
    headers={"x-api-key": API_KEY},
    json={
        "season": 2026,
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

teams = pd.DataFrame(data["teams"]).set_index("abbrev")
cols = ["pace", "off_rating", "def_rating", "net_rating", "efg_pct", "tov_pct", "oreb_pct", "ft_rate"]
print(teams[cols].sort_values("net_rating", ascending=False).head(10))
print(teams[["pace", "net_rating"]].corr().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.

What comes back

The data object of the response, trimmed to the first rows. Every field is real output from the run above.

{
  "season": 2026,
  "teams": [
    {
      "abbrev": "OKC",
      "games": 82,
      "wins": 64,
      "losses": 18,
      "pace": 102.6,
      "off_rating": 116,
      "def_rating": 105.1,
      "net_rating": 10.9,
      "efg_pct": 0.561,
      "tov_pct": 0.123,
      "oreb_pct": 0.223,
      "ft_rate": 0.261
    },
    {
      "abbrev": "DET",
      "games": 82,
      "wins": 60,
      "losses": 22,
      "pace": 102.9,
      "off_rating": 114.4,
      "def_rating": 106.5,
      "net_rating": 7.9,
      "efg_pct": 0.546,
      "tov_pct": 0.147,
      "oreb_pct": 0.309,
      "ft_rate": 0.292
    },
    "...28 more"
  ],
  "count": 30,
  "method": "Possessions = FGA - OREB + TOV + 0.44 x FTA, averaged over both teams. Ratings are points per 100 possessions."
}

What to do next

  • get_standings (2 credits). Add conference and home or away records from the same games.
  • get_shot_chart (10 credits). Pass opponent with a team to see the shots its defence gives up.

More guides

Start with 500 free credits

No card. REST or MCP.