Skip to main content

NBA — additional Python functions — RealGM

realgm_close_browser​

realgm_close_browser() -> 'None'

Close the cached headless browser, if one is open.

The browser is otherwise kept for SDV_PY_REALGM_TTL idle seconds and released at interpreter exit. Call this to free it early -- after a batch pull, or before a long stretch of work that will not touch RealGM.

Example

from sportsdataverse.nba.realgm import realgm_players, realgm_close_browser

players = realgm_players()
realgm_close_browser()

realgm_coaches​

realgm_coaches(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Current NBA head coaches.

Port of hoopR's realgm_coaches() (staff-role id 20).

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per coach -- staff, team, start_season, years_in_role, birth_date, nationality. Zero rows when the page carried no data table.

col_nametypedescription
staffStringCoach name.
teamStringTeam-side label or team identifier.
start_seasonStringSeason the coach started with the team.
years_in_roleInt64Seasons in the role.
birth_dateStringDate of birth (YYYY-MM-DD).
nationalityStringPlayer nationality.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_coaches

coaches = realgm_coaches()
print(coaches.shape)

realgm_draft​

realgm_draft(year: 'Optional[int]' = None, *, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Results of one past NBA draft.

Port of hoopR's realgm_draft(). Every table carrying player / pos / ht is stacked: the pick tables plus RealGM's listed undrafted players. round is derived from the overall pick number (> 30 -> round 2) as in the R original, and is null for a table with no pick column (the undrafted list).

Parameters

ParameterTypeDefaultDescription
yearOptional[int]NoneDraft year (the calendar year the draft was held). Defaults to the most recently completed draft.
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per selection -- pick, player, team, draft_trades, pos, ht, wt, age, yos, pre_draft_team, class, nationality, plus round and draft_year. Zero rows when no draft table was found.

col_nametypedescription
pickInt64Pick number within the round.
playerStringPlayer name.
teamStringTeam-side label or team identifier.
draft_tradesStringDraft-night trade note, if any.
posStringPosition.
htStringListed height.
wtInt64Listed weight (lbs).
ageInt64Player age (in years).
yosInt64Years of service.
pre_draft_teamStringPre-draft team / school / club.
classStringCollege class / draft eligibility note.
nationalityStringPlayer nationality.
roundInt64Tournament / playoff round.
draft_yearInt64Draft year (4-digit).

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_draft

draft = realgm_draft(year=2020)
print(draft.shape)

# Pipeline next step

draft.filter(pl.col("round") == 1).head()

realgm_draft_prospects​

realgm_draft_prospects(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Current NBA draft-prospect statistics.

Port of hoopR's realgm_draft_prospects().

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per prospect -- player, team (school / club), gp, mpg, ppg, shooting splits, rpg, apg, spg, bpg. Zero rows when the page carried no data table.

No returns table is published for this function: no capture: the RealGM page it reads now carries no table, so it returns an empty frame.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_draft_prospects

prospects = realgm_draft_prospects()
print(prospects.shape)

realgm_early_entry​

realgm_early_entry(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The current NBA draft early-entrant and withdrawal list.

Port of hoopR's realgm_early_entry(): RealGM's college and international entrant/withdrawal tables stacked into one frame.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per candidate -- player, pos, ht, wt, birth_date, college / pre_draft_team, class, draft_status, yos, nationality. Zero rows when no early-entry table was found.

col_nametypedescription
playerStringPlayer name.
posStringPosition.
htStringListed height.
wtFloat64Listed weight (lbs).
birth_dateStringDate of birth (YYYY-MM-DD).
collegeStringCollege.
classStringCollege class / draft eligibility note.
draft_statusStringDraft pick / undrafted status.
yosInt64Years of service.
nationalityStringPlayer nationality.
pre_draft_teamStringPre-draft team / school / club.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_early_entry

entrants = realgm_early_entry()
print(entrants.shape)

realgm_future_free_agents​

realgm_future_free_agents(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

RealGM's projected future NBA free-agent classes, with each player's agent.

Port of hoopR's realgm_future_free_agents(). The agent column is the distinctive one -- no first-party feed publishes it.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per upcoming free agent -- player, pos, team, season, age, yos, veteran_fa_status, gp, pts, reb, ast, per, agent. Zero rows when the page carried no data table.

col_nametypedescription
playerStringPlayer name.
posStringPosition.
teamStringTeam-side label or team identifier.
seasonStringSeason year.
ageInt64Player age (in years).
yosInt64Years of service.
veteran_fa_statusStringBird / Non-Bird / veteran FA status.
gpInt64Games played.
ptsFloat64Points scored.
rebFloat64Rebounds per game.
astFloat64Assists.
perFloat64Player Efficiency Rating.
agentStringListed player agent.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_future_free_agents

fas = realgm_future_free_agents()
print(fas.shape)

# Pipeline next step

fas.group_by("agent").agg(pl.len().alias("clients")).sort("clients", descending=True)

realgm_gms​

realgm_gms(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Current NBA general managers.

Port of hoopR's realgm_gms() (staff-role id 16).

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per general manager -- staff, team, start_season, years_in_role, birth_date, nationality. Zero rows when the page carried no data table.

col_nametypedescription
staffStringCoach name.
teamStringTeam-side label or team identifier.
start_seasonStringSeason the coach started with the team.
years_in_roleInt64Seasons in the role.
birth_dateStringDate of birth (YYYY-MM-DD).
nationalityStringPlayer nationality.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_gms

gms = realgm_gms()
print(gms.shape)

realgm_individual_games​

realgm_individual_games(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The all-time best individual NBA games leaderboard.

Port of hoopR's realgm_individual_games().

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per player-game -- player, date, team, min, pts, fgm, fga, reb, ast, stl, blk, ... Zero rows when the page carried no data table.

No returns table is published for this function: no capture: the RealGM page it reads now carries no table, so it returns an empty frame.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_individual_games

best = realgm_individual_games()
print(best.shape)

realgm_individual_seasons​

realgm_individual_seasons(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The all-time best individual NBA seasons leaderboard.

Port of hoopR's realgm_individual_seasons().

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per player-season -- player, season, team, gp, min, pts, shooting splits, reb, ast, ... Zero rows when the page carried no data table.

col_nametypedescription
numberFloat64Number.
playerStringPlayer name.
seasonInt64Season year.
teamStringTeam-side label or team identifier.
gpInt64Games played.
minFloat64Minutes played.
ptsFloat64Points scored.
fgmFloat64Field goals made.
fgaFloat64Field goal attempts.
fg_pctFloat64Field goal percentage (0-1).
3_pmString
3_paString
3_p_pctString
ftmFloat64Free throws made.
ftaFloat64Free throw attempts.
ft_pctFloat64Free throw percentage (0-1).
orbString
drbString
rebFloat64Rebounds per game.
astFloat64Assists.
stlStringSteals.
blkStringBlocks.
tovStringTurnovers.
pfFloat64Personal fouls.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_individual_seasons

best = realgm_individual_seasons()
print(best.shape)

realgm_player_stats​

realgm_player_stats(season: 'Optional[int]' = None, stat_type: 'str' = 'Averages', season_type: 'str' = 'Regular_Season', *, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Season player-statistics leaderboard for one stat family and season segment.

Port of hoopR's realgm_player_stats().

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]NoneSeason by ending year (2026 = 2025-26). Defaults to sportsdataverse.nba.nba_schedule.most_recent_nba_season.
stat_typestr'Averages'One of "Averages", "Totals", "Per_48", "Per_40", "Per_36", "Per_Minute", "Advanced_Stats", "Misc_Stats".
season_typestr'Regular_Season'One of "Regular_Season", "Playoffs", "Preseason", "Summer_League".
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per qualified player, columns varying by stat_type (for "Averages": player, team, gp, mpg, ppg, rpg, apg, ...), plus the echoed season / stat_type / season_type. Zero rows when the page carried no data table.

col_nametypedescription
numberFloat64Number.
playerStringPlayer name.
teamStringTeam-side label or team identifier.
gpInt64Games played.
mpgFloat64Minutes per game.
ppgFloat64Points per game.
fgmFloat64Field goals made.
fgaFloat64Field goal attempts.
fg_pctFloat64Field goal percentage (0-1).
3_pmFloat64
3_paFloat64
3_p_pctFloat64
ftmFloat64Free throws made.
ftaFloat64Free throw attempts.
ft_pctFloat64Free throw percentage (0-1).
orbFloat64
drbFloat64
rpgFloat64Rebounds per game.
apgFloat64Assists per game.
spgFloat64Steals per game.
bpgFloat64Blocks per game.
tovFloat64Turnovers.
pfFloat64Personal fouls.
seasonInt64Season year.
stat_typeStringStat type code (e.g. "win", "loss").
season_typeStringSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_player_stats

stats = realgm_player_stats(season=2025, stat_type="Averages")
print(stats.shape)

# Pipeline next step

stats.sort("ppg", descending=True).head(10)

realgm_players​

realgm_players(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The active NBA player index from RealGM.

Port of hoopR's realgm_players(). RealGM's roster of active players, including the pre-draft / international club detail the site is uniquely good for (Jokic -> "KK Mega Bemax (Serbia)").

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html. Defaults to the headless-browser fetch; inject one to run offline.
proxyOptional[str]NoneProxy URL for the browser launch. Falls back to SDV_PY_REALGM_PROXY then SDV_PY_PROXY.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per active player -- number, player, pos, ht, wt, age, current_team, yos, pre_draft_team, draft_status, nationality (transcribed from hoopR; unverified against live HTML). A zero-row frame when the page carried no data table.

col_nametypedescription
numberFloat64Number.
playerStringPlayer name.
posStringPosition.
htStringListed height.
wtInt64Listed weight (lbs).
ageInt64Player age (in years).
current_teamStringCurrent NBA team.
yosInt64Years of service.
pre_draft_teamStringPre-draft team / school / club.
draft_statusStringDraft pick / undrafted status.
nationalityStringPlayer nationality.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_players

players = realgm_players()
print(players.shape)

# Offline / testing -- inject a transport, no browser needed

players = realgm_players(fetcher=lambda path, proxy: "<html>...</html>")

# Pipeline next step

players.filter(pl.col("nationality") != "United States").head()

realgm_players_abroad​

realgm_players_abroad(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

NBA-affiliated players currently playing overseas.

Port of hoopR's realgm_players_abroad(). Draft picks, two-way and free-agent players on international rosters -- a view no first-party NBA/ESPN endpoint provides.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per player -- player, pos, ht, wt, nba_status, team_s, gp, mpg, ppg, rpg, apg. Zero rows when the page carried no data table.

col_nametypedescription
playerStringPlayer name.
posStringPosition.
htStringListed height.
wtInt64Listed weight (lbs).
nba_statusStringNBA contract / rights status.
team_sStringCurrent overseas team(s) and NBA affiliation.
gpInt64Games played.
mpgFloat64Minutes per game.
ppgFloat64Points per game.
rpgFloat64Rebounds per game.
apgFloat64Assists per game.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_players_abroad

abroad = realgm_players_abroad()
print(abroad.shape)

realgm_rookie_scale​

realgm_rookie_scale(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The current NBA rookie-scale salary table.

Port of hoopR's realgm_rookie_scale(). Dollar figures are the formatted strings RealGM publishes.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per first-round pick -- pick, the four contract-year amounts, the 4th-year option increase and the qualifying-offer increase. Zero rows when the page carried no data table.

col_nametypedescription
pickInt64Pick number within the round.
1st_year_salaryString
2nd_year_salaryString
3rd_year_option_salaryString
4th_year_option_percentage_increased_over_3rd_year_salaryString
qualifying_offer_percentage_increase_over_4th_year_salaryString

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_rookie_scale

scale = realgm_rookie_scale()
print(scale.shape)

realgm_salary_cap​

realgm_salary_cap(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

NBA salary-cap history and projections.

Port of hoopR's realgm_salary_cap(). Dollar figures come back as the formatted strings RealGM publishes ("$140,588,000") -- strip non-numeric characters to get numerics.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per season -- season, salary_cap, luxury_tax, x1st_apron, x2nd_apron, bae, non_taxpayer_mle, taxpayer_mle, team_room_mle. Zero rows when the page carried no data table.

col_nametypedescription
seasonStringSeason year.
salary_capStringSalary cap.
luxury_taxStringLuxury-tax threshold.
1st_apronString
2nd_apronString
baeStringBi-annual exception.
non_taxpayer_mleStringNon-taxpayer mid-level exception.
taxpayer_mleStringTaxpayer mid-level exception.
team_room_mleStringRoom mid-level exception.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_salary_cap

caps = realgm_salary_cap()
print(caps.shape)

# Pipeline next step -- parse the dollar strings

caps.with_columns(pl.col("salary_cap").str.replace_all(r"[^0-9.]", "").cast(pl.Float64))

realgm_standings​

realgm_standings(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Current NBA standings, both conferences stacked.

Port of hoopR's realgm_standings(). The Eastern and Western conference tables are row-bound and labelled by a conference column, assigned by table order (first qualifying table -> Eastern) exactly as the R original does -- so a RealGM layout change that reorders the two tables would mislabel them.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per team -- number, team, w, l, pct, gb, l10, strk, ppg, oppg, diff, home, away plus conference ("Eastern" / "Western"). Zero rows when no standings table was found.

col_nametypedescription
numberInt64Number.
teamStringTeam-side label or team identifier.
wInt64Wins.
lInt64Losses.
pctFloat64Win percentage.
gbInt64Games behind the conference leader.
l10StringLast-ten record.
strkInt64Current streak.
ppgInt64Points per game.
oppgInt64Opponent points per game.
diffInt64Scoring margin.
homeStringHome.
awayStringAway record.
divString
confStringcharacter.
remInt64
rowpFloat64
conferenceStringConference name.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_standings

standings = realgm_standings()
print(standings.shape)

# Pipeline next step

standings.filter(pl.col("conference") == "Eastern").head()

realgm_team_stats​

realgm_team_stats(season: 'Optional[int]' = None, stat_type: 'str' = 'Averages', season_type: 'str' = 'Regular_Season', *, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Season team statistics for one stat family and season segment.

Port of hoopR's realgm_team_stats().

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]NoneSeason by ending year (2026 = 2025-26). Defaults to sportsdataverse.nba.nba_schedule.most_recent_nba_season.
stat_typestr'Averages'One of "Averages", "Totals", "Advanced_Stats", "Misc_Stats".
season_typestr'Regular_Season'One of "Regular_Season", "Playoffs", "Preseason", "Summer_League".
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per team (team, gp, mpg, ppg, rpg, apg, ... for "Averages") plus the echoed season / stat_type / season_type. Zero rows when the page carried no data table.

col_nametypedescription
numberFloat64Number.
teamStringTeam-side label or team identifier.
ts_pctFloat64True shooting percentage (0-1).
e_fg_pctFloat64E field goals percentage (0-1 decimal).
total_s_pctFloat64
orb_pctFloat64Offensive rebound percentage.
drb_pctFloat64Defensive rebound percentage.
trb_pctFloat64
ast_pctFloat64Assist percentage.
tov_pctFloat64
stl_pctFloat64Steals percentage (0-1 decimal).
blk_pctFloat64Blocks percentage (0-1 decimal).
ppsFloat64
fic40Float64
o_rtgFloat64O rtg.
d_rtgFloat64
e_diffFloat64
possFloat64Poss.
paceFloat64Possessions per 48 minutes.
seasonInt64Season year.
stat_typeStringStat type code (e.g. "win", "loss").
season_typeStringSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_team_stats

teams = realgm_team_stats(season=2025, stat_type="Advanced_Stats")
print(teams.shape)

realgm_teams​

realgm_teams(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The NBA team index with division and conference.

Port of hoopR's realgm_teams(). RealGM renders one small table per division, headed by e.g. "Atlantic Division"; the division name comes from that first header and the conference from a static division -> conference map.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per team -- team, division, conference. Zero rows (with that schema) when no division table was recognised.

col_nametypedescription
teamStringTeam-side label or team identifier.
divisionStringTeam division.
conferenceStringConference name.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_teams

teams = realgm_teams()
print(teams.shape)

realgm_transactions​

realgm_transactions(*, fetcher: 'Optional[Fetcher]' = None, proxy: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

The NBA league transactions log.

Port of hoopR's realgm_transactions() -- the one non-tabular RealGM page. RealGM publishes transactions as a dated narrative list (h3 date heading + ul li items), so this parses the DOM rather than a <table>.

Parameters

ParameterTypeDefaultDescription
fetcherOptional[Fetcher]NoneCallable (path, proxy) -> html; defaults to the headless-browser fetch.
proxyOptional[str]NoneProxy URL for the browser launch (env fallback SDV_PY_REALGM_PROXY).
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per transaction -- date (polars.Date) and transaction (text). Zero rows (with that schema) when no dated block parsed.

col_nametypedescription
dateStringDate in YYYY-MM-DD format.
transactionStringTransaction description.

Raises

ExceptionDescription
ImportErrorWhen Playwright is missing and no fetcher was supplied.
AssetFetchErrorThe page was still Cloudflare's challenge page (it never cleared). It is a failed fetch, never a zero-row answer.

Example

from sportsdataverse.nba.realgm import realgm_transactions

log = realgm_transactions()
print(log.shape)

# Pipeline next step

log.filter(pl.col("transaction").str.contains("(?i)two-way")).head()