WNBA — additional Python functions — Wnba: rapm–win
wnba_rapm_from_games
wnba_rapm_from_games(game_ids: 'Sequence[str]', *, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'
Compute per-player RAPM estimates over a sequence of WNBA games.
Iterates game_ids, builds the possession-level stint matrix for each
via wnba_possessions, concatenates the results, and fits a
ridge-regression RAPM model via
~sportsdataverse.nba.nba_rapm.nba_rapm. Games whose possession
frame is empty (e.g. a malformed payload) are silently skipped. Returns
a zero-row frame when no valid possessions are found.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
game_ids | Sequence[str] | Sequence of WNBA game identifier strings. | |
return_as_pandas | bool | False | If True, convert the result to a pandas.DataFrame before returning. |
Returns
Polars (or pandas) DataFrame with one row per player and columns player_id (Int64), o_rapm (Float64), d_rapm (Float64), rapm (Float64), off_poss (Int64), def_poss (Int64).
Example
from sportsdataverse.wnba.wnba_engine import wnba_rapm_from_games
rapm = wnba_rapm_from_games(["1022400001", "1022400003"])
print(rapm.sort("rapm", descending=True).head())
# Pandas output
rapm_pd = wnba_rapm_from_games(["1022400001"], return_as_pandas=True)
print(type(rapm_pd))
# Multi-season aggregation
import polars as pl
game_ids = pl.read_parquet("wnba_schedule.parquet")["game_id"].to_list()
rapm = wnba_rapm_from_games(game_ids)
print(rapm.sort("rapm", descending=True).head(10))
wnba_referee_assignments
wnba_referee_assignments(date: 'str | _dt.date', *, raw: 'bool' = False, return_as_pandas: 'bool' = False, proxy: 'dict | None' = None) -> 'dict[str, Any]'
Fetch and parse WNBA referee assignments for a given date from official.nba.com.
Retrieves the referee crew assignments and replay center officials for all WNBA
games on a given date. The crew_position column (1–4) represents the feed's
slot order; slot 1 is inferred to be the crew chief. The season column is
the WNBA single-year season (feed year converted as-is). This is a thin shim
over sportsdataverse.nba.nba_officiating.nba_referee_assignments that
sets league="wnba".
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
date | str | date | The date to fetch assignments for (str in "YYYY-MM-DD" format or datetime.date). | |
raw | bool | False | If True, return the raw JSON payload (dict) with all three leagues instead of parsed DataFrames. |
return_as_pandas | bool | False | If True, return pandas DataFrames instead of polars. |
proxy | dict | None | None | Optional proxy dict passed through to the HTTP layer. |
Returns
A dict with keys "officials" and "replay_center" mapping to DataFrames. If raw=True, returns the full three-league JSON payload instead.
| col_name | type | description |
|---|---|---|
officials.league | character | League the assignment belongs to: nba, gl (G League), or wnba. |
officials.game_id | character | 10-digit game id (zero-padded) for the assigned game. |
officials.game_date | date | Game date parsed from the feed's MM/DD/YYYY format. |
officials.season | integer | Season end year, converted from the feed's |
officials.season_type | character | Season type decoded from the feed's season code first digit: preseason, regular, all-star, playoffs, play-in, or nba-cup-final. |
officials.game_code | character | League game code in YYYYMMDD/AWYHOM format, matching the away and home team abbreviations. |
officials.home_team_id | integer | 10-digit team id of the home team. |
officials.home_team_abbr | character | Three-letter abbreviation of the home team. |
officials.away_team_id | integer | 10-digit team id of the away team. |
officials.away_team_abbr | character | Three-letter abbreviation of the away team. |
officials.crew_position | integer | Feed's official slot order (1-4); slot 1 is inferred to be the crew chief since the API does not label roles. |
officials.official_id | integer | Numeric official id from the feed (source field official{n}_code); expected to match stats.nba.com's OFFICIAL_ID. |
officials.official_name | character | Official's display name for this crew slot. |
officials.jersey_num | character | Official's jersey number as a string, from the feed's official{n}_JNum field. |
replay_center.league | character | League the replay-center staffing belongs to: nba, gl, or wnba. |
replay_center.game_date | date | Date the replay-center official worked; a date-level staffing record, not tied to one game. |
replay_center.official_id | integer | Numeric replay-center official id from the feed. |
replay_center.official_name | character | Replay-center official's display name for that date. |
Example
from sportsdataverse.wnba.wnba_officiating import wnba_referee_assignments
result = wnba_referee_assignments("2026-06-13")
officials = result["officials"]
print(f"Found {officials.height} official slots")
wnba_rookie_projection
wnba_rookie_projection(draft_year: "'int | list[int]'", *, return_as_pandas: 'bool' = False) -> "'pl.DataFrame | pd.DataFrame'"
WNBA rookie/sophomore projection -- composes the WNBA draft/aging/availability pieces.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
draft_year | int | list[int] | A draft year or list of years. | |
return_as_pandas | bool | False | Return a pandas DataFrame instead of polars. |
Returns
Frame player_id:Utf8, draft_year:Int64, proj_rookie_value:Float64, proj_soph_value:Float64, proj_rookie_min:Float64, proj_avail_pct:Float64, pro_tier:Utf8. Empty input -> zero-row schema.
Example
from sportsdataverse.wnba import wnba_rookie_projection
board = wnba_rookie_projection(2023)
wnba_schedule_crosswalk
wnba_schedule_crosswalk(season: 'Optional[int]' = None, *, stats_games: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False, strict: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame']"
Build the WNBA cross-source schedule crosswalk (ESPN / WNBA Stats).
One row per game, joined on (game_date, home_espn_team_id, away_espn_team_id) after both sides reduce to the Eastern-Time date. The
Stats CDN serves the current season only, so the live builder is
effectively current-season.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | Optional[int] | None | Season year (e.g. 2026). Defaults to the most recent WNBA season. |
stats_games | Optional[DataFrame] | None | Pre-fetched Stats schedule frame; None fetches live. |
return_as_pandas | bool | False | Return pandas instead of polars. |
strict | bool | False | Raise on the first failed per-date ESPN scoreboard fetch (a 404 is still skipped) instead of skipping isolated failures. Default False matches the R producers; a provider whose every item failed raises either way. An item the host answered -- including a 404 -- counts as answered. |
Returns
pl.DataFrame (or pandas) with SCHEDULE_COLUMNS.
Example
from sportsdataverse.wnba import wnba_schedule_crosswalk
df = wnba_schedule_crosswalk(season=2026)
print(df["match_method"].value_counts())
# Pipeline next step (one line)
df.filter(pl.col("match_method") == "both").select("espn_game_id", "wnba_game_id").head()
wnba_shot_value
wnba_shot_value(player_ids: "'list[int]'", season: 'str', *, include_context: 'bool' = False, return_as_pandas: 'bool' = False) -> "'dict[str, Union[pl.DataFrame, pd.DataFrame]]'"
WNBA one-call shot-value spine (league_id="10").
Thin wrapper binding sportsdataverse.nba.nba_shot_value.nba_shot_value
to the women's league; fetches each player's shotchartdetail, scores
per-shot expected points from the free LeagueAverages zone table, and
returns the scored shots plus shooter talent, selection quality, and
zone-value maps (and the defender/shot-clock context tables when
include_context=True). Women's court geometry + shrinkage constant are
keyed "10" in nba_shot_value_constants.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
player_ids | list[int] | Player ids to fetch. | |
season | str | Season string, e.g. "2024". | |
include_context | bool | False | Also fetch + return the playerdashptshots defender/shot-clock context tables. |
return_as_pandas | bool | False | Return pandas frames instead of polars. |
Returns
{"shots", "talent", "selection", "zones"} (plus "context" when requested). An empty fetch returns a dict of zero-row frames.
Example
from sportsdataverse.wnba import wnba_shot_value
out = wnba_shot_value([1628886], "2024")
out["talent"].head()
wnba_team_clutch
wnba_team_clutch(season: 'int', *, league_id: 'str' = '00', return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'
WNBA clutch skill (league_id='10'). See sportsdataverse.nba.nba_clutch.nba_team_clutch.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | int | ||
league_id | str | '00' | |
return_as_pandas | bool | False |
wnba_team_crosswalk
wnba_team_crosswalk(season: 'Optional[int]' = None, *, stats: 'Optional[pl.DataFrame]' = None, fox: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame']"
Build the WNBA cross-source team crosswalk (ESPN / WNBA Stats / Fox).
One row per ESPN team, keyed on espn_team_id. The Stats side is
derived from the season schedule's home/away team fields (as in wehoop)
and joined on the normalized city + name.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | Optional[int] | None | Season year (e.g. 2026). Defaults to the most recent WNBA season. |
stats | Optional[DataFrame] | None | Pre-fetched Stats team directory. None derives it from the Stats schedule. |
fox | Optional[DataFrame] | None | Pre-fetched fox_wnba_teams() frame. None fetches live. |
return_as_pandas | bool | False | Return pandas instead of polars. |
Returns
pl.DataFrame (or pandas), one row per ESPN team, with TEAM_COLUMNS.
Example
from sportsdataverse.wnba import wnba_team_crosswalk
df = wnba_team_crosswalk(season=2026)
print(df.shape)
# Offline with pre-fetched provider frames
df = wnba_team_crosswalk(season=2026, stats=my_stats, fox=my_fox)
# Pipeline next step (one line)
df.select("espn_team_id", "wnba_team_id", "match_method").head()
wnba_team_ratings
wnba_team_ratings(seasons: 'Union[int, list[int]]', *, league_id: 'str' = '00', as_of_date: 'Union[dt.date, None]' = None, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"
WNBA team ratings (league_id='10'). See sportsdataverse.nba.nba_team_ratings.nba_team_ratings.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | Union[int, list[int]] | ||
league_id | str | '00' | |
as_of_date | Union[date, None] | None | |
return_as_pandas | bool | False |
wnba_tracking_drive_value
wnba_tracking_drive_value(seasons: "'int | str | list'", *, league_id: 'str' = '10', per_mode: 'str' = 'Totals', by_position: 'bool' = True, positions: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False, _get_fn: 'Optional[Callable[..., dict]]' = None) -> "'Union[pl.DataFrame, pd.DataFrame]'"
WNBA drive value + rim-pressure (league_id="10" by-reference shim).
See sportsdataverse.nba.nba_tracking_value.nba_tracking_drive_value
for the full recipe.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | str | list | A single season or list of seasons. | |
league_id | str | '10' | Defaults to "10" (WNBA); pass "20" here for G-League. |
per_mode | str | 'Totals' | per_mode_simple passed to the fetch (default "Totals"). |
by_position | bool | True | Compute the baseline within role buckets (default); False forces one league-wide bucket. |
positions | Optional[DataFrame] | None | Optional pre-fetched positions frame. |
return_as_pandas | bool | False | Return a pandas.DataFrame instead of polars. |
_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_leaguedashptstats. |
Returns
One row per player-season: season:Int64, player_id:Utf8, player_name:Utf8, team_id:Utf8, position_bucket:Utf8, gp:Int64, min:Float64, drives:Float64, drive_pts:Float64, drive_baseline_rate:Float64, drive_expected:Float64, drive_pts_oe:Float64, drive_pts_oe_per_36:Float64, drive_fta:Float64, rim_pressure:Float64, drive_ast:Float64, drive_tov:Float64, league_id:Utf8. Empty/malformed input returns a zero-row frame with this schema.
Example
from sportsdataverse.wnba import wnba_tracking_drive_value
df = wnba_tracking_drive_value(2024)
print(df.sort("drive_pts_oe", descending=True).head())
wnba_tracking_pass_value
wnba_tracking_pass_value(seasons: "'int | str | list'", *, league_id: 'str' = '10', per_mode: 'str' = 'Totals', by_position: 'bool' = True, positions: 'Optional[pl.DataFrame]' = None, fetch_potential_assists: 'bool' = False, max_players: 'int' = 0, return_as_pandas: 'bool' = False, _get_fn: 'Optional[Callable[..., dict]]' = None, _pass_get_fn: 'Optional[Callable[..., dict]]' = None) -> "'Union[pl.DataFrame, pd.DataFrame]'"
WNBA expected-assists / passer value (league_id="10" by-reference shim).
See sportsdataverse.nba.nba_tracking_value.nba_tracking_pass_value
for the full recipe (Passing-measure proxy + optional playerdashptpass
enrichment).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | str | list | A single season or list of seasons. | |
league_id | str | '10' | Defaults to "10" (WNBA); pass "20" here for G-League. |
per_mode | str | 'Totals' | per_mode_simple passed to the fetch (default "Totals"). |
by_position | bool | True | Compute the baseline within role buckets (default); False forces one league-wide bucket. |
positions | Optional[DataFrame] | None | Optional pre-fetched positions frame. |
fetch_potential_assists | bool | False | Enrich the top passers with playerdashptpass potential-assist counts. |
max_players | int | 0 | Cap on per-player enrichment fetches; 0 disables enrichment regardless of fetch_potential_assists. |
return_as_pandas | bool | False | Return a pandas.DataFrame instead of polars. |
_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_leaguedashptstats. |
_pass_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_playerdashptpass. |
Returns
One row per player-season: season:Int64, player_id:Utf8, player_name:Utf8, team_id:Utf8, position_bucket:Utf8, gp:Int64, min:Float64, ast:Float64, passes:Float64, ast_baseline_rate:Float64, ast_expected:Float64, ast_oe:Float64, ast_oe_per_36:Float64, ast_pts_created:Float64, league_id:Utf8. Empty/malformed input returns a zero-row frame with this schema.
Example
from sportsdataverse.wnba import wnba_tracking_pass_value
df = wnba_tracking_pass_value(2024)
print(df.sort("ast_oe", descending=True).head())
wnba_tracking_reb_oe
wnba_tracking_reb_oe(seasons: "'int | str | list'", *, league_id: 'str' = '10', per_mode: 'str' = 'Totals', by_position: 'bool' = True, positions: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False, _get_fn: 'Optional[Callable[..., dict]]' = None) -> "'Union[pl.DataFrame, pd.DataFrame]'"
WNBA rebounding-over-expected (league_id="10" by-reference shim).
See sportsdataverse.nba.nba_tracking_value.nba_tracking_reb_oe
for the full recipe (contest-difficulty-adjusted expected rebounds,
role-bucket baseline).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | str | list | A single season or list of seasons. | |
league_id | str | '10' | Defaults to "10" (WNBA); pass "20" here for G-League. |
per_mode | str | 'Totals' | per_mode_simple passed to the fetch (default "Totals"). |
by_position | bool | True | Compute the baseline within role buckets (default); False forces one league-wide bucket. |
positions | Optional[DataFrame] | None | Optional pre-fetched positions frame. |
return_as_pandas | bool | False | Return a pandas.DataFrame instead of polars. |
_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_leaguedashptstats. |
Returns
One row per player-season: season:Int64, player_id:Utf8, player_name:Utf8, team_id:Utf8, position_bucket:Utf8, gp:Int64, min:Float64, reb:Float64, reb_chances:Float64, reb_baseline_rate:Float64, reb_expected:Float64, reb_oe:Float64, reb_oe_per_36:Float64, oreb_oe:Float64, dreb_oe:Float64, league_id:Utf8. Empty/malformed input returns a zero-row frame with this schema.
Example
from sportsdataverse.wnba import wnba_tracking_reb_oe
df = wnba_tracking_reb_oe(2024)
print(df.sort("reb_oe", descending=True).head())
wnba_tracking_rim_protect_value
wnba_tracking_rim_protect_value(seasons: "'int | str | list'", *, league_id: 'str' = '10', per_mode: 'str' = 'Totals', by_position: 'bool' = True, positions: 'Optional[pl.DataFrame]' = None, source: 'str' = 'leaguedash', max_players: 'int' = 0, return_as_pandas: 'bool' = False, _get_fn: 'Optional[Callable[..., dict]]' = None, _defend_get_fn: 'Optional[Callable[..., dict]]' = None) -> "'Union[pl.DataFrame, pd.DataFrame]'"
WNBA rim-protection / shot-defend points-saved (league_id="10"
by-reference shim).
See sportsdataverse.nba.nba_tracking_value.nba_tracking_rim_protect_value
for the full recipe (bucket-mean defended-rate baseline; optional
playerdashptshotdefend rim-band enrichment).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | str | list | A single season or list of seasons. | |
league_id | str | '10' | Defaults to "10" (WNBA); pass "20" here for G-League. |
per_mode | str | 'Totals' | per_mode_simple passed to the fetch (default "Totals"). |
by_position | bool | True | Compute the baseline within role buckets (default); False forces one league-wide bucket. |
positions | Optional[DataFrame] | None | Optional pre-fetched positions frame. |
source | str | 'leaguedash' | "leaguedash" (default) or "shotdefend". |
max_players | int | 0 | Cap on per-player shotdefend enrichment fetches; ignored unless source="shotdefend". |
return_as_pandas | bool | False | Return a pandas.DataFrame instead of polars. |
_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_leaguedashptstats. |
_defend_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_playerdashptshotdefend. |
Returns
One row per player-season: season:Int64, player_id:Utf8, player_name:Utf8, team_id:Utf8, position_bucket:Utf8, gp:Int64, min:Float64, d_fga:Float64, d_fgm:Float64, d_fg_pct:Float64, normal_fg_pct:Float64, rim_protect_pts_saved:Float64, rim_protect_pts_saved_per_36:Float64, source:Utf8, league_id:Utf8. Empty/malformed input returns a zero-row frame with this schema.
Example
from sportsdataverse.wnba import wnba_tracking_rim_protect_value
df = wnba_tracking_rim_protect_value(2024)
print(df.sort("rim_protect_pts_saved", descending=True).head())
wnba_tracking_shot_diet_value
wnba_tracking_shot_diet_value(seasons: "'int | str | list'", *, league_id: 'str' = '10', per_mode: 'str' = 'Totals', by_position: 'bool' = True, positions: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False, _get_fn: 'Optional[Callable[..., dict]]' = None) -> "'Union[pl.DataFrame, pd.DataFrame]'"
WNBA catch-&-shoot vs pull-up points-over-expected (league_id="10"
by-reference shim).
See sportsdataverse.nba.nba_tracking_value.nba_tracking_shot_diet_value
for the full recipe.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | str | list | A single season or list of seasons. | |
league_id | str | '10' | Defaults to "10" (WNBA); pass "20" here for G-League. |
per_mode | str | 'Totals' | per_mode_simple passed to each fetch (default "Totals"). |
by_position | bool | True | Compute each measure's baseline within role buckets (default); False forces one league-wide bucket. |
positions | Optional[DataFrame] | None | Optional pre-fetched positions frame. |
return_as_pandas | bool | False | Return a pandas.DataFrame instead of polars. |
_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_leaguedashptstats. |
Returns
One row per player-season: season:Int64, player_id:Utf8, player_name:Utf8, team_id:Utf8, position_bucket:Utf8, cs_fga:Float64, cs_pts:Float64, cs_pts_oe:Float64, pu_fga:Float64, pu_pts:Float64, pu_pts_oe:Float64, shot_diet_delta:Float64, league_id:Utf8. Empty/malformed input returns a zero-row frame with this schema.
Example
from sportsdataverse.wnba import wnba_tracking_shot_diet_value
df = wnba_tracking_shot_diet_value(2024)
print(df.sort("cs_pts_oe", descending=True).head())
wnba_tracking_touch_value
wnba_tracking_touch_value(seasons: "'int | str | list'", *, league_id: 'str' = '10', per_mode: 'str' = 'Totals', by_position: 'bool' = True, positions: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False, _get_fn: 'Optional[Callable[..., dict]]' = None) -> "'Union[pl.DataFrame, pd.DataFrame]'"
WNBA touch / possession-time value (league_id="10" by-reference shim).
See sportsdataverse.nba.nba_tracking_value.nba_tracking_touch_value
for the full recipe.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | str | list | A single season or list of seasons. | |
league_id | str | '10' | Defaults to "10" (WNBA); pass "20" here for G-League. |
per_mode | str | 'Totals' | per_mode_simple passed to the fetch (default "Totals"). |
by_position | bool | True | Compute the baseline within role buckets (default); False forces one league-wide bucket. |
positions | Optional[DataFrame] | None | Optional pre-fetched positions frame. |
return_as_pandas | bool | False | Return a pandas.DataFrame instead of polars. |
_get_fn | Optional[Callable[..., dict]] | None | Injectable replacement for nba_stats_leaguedashptstats. |
Returns
One row per player-season: season:Int64, player_id:Utf8, player_name:Utf8, team_id:Utf8, position_bucket:Utf8, gp:Int64, min:Float64, touches:Float64, pts:Float64, touch_baseline_rate:Float64, touch_expected:Float64, pts_per_touch_oe:Float64, time_of_poss:Float64, time_of_poss_eff:Float64, league_id:Utf8. Empty/malformed input returns a zero-row frame with this schema.
Example
from sportsdataverse.wnba import wnba_tracking_touch_value
df = wnba_tracking_touch_value(2024)
print(df.sort("pts_per_touch_oe", descending=True).head())
wnba_win_prob_from_margin
wnba_win_prob_from_margin(exp_margin: 'float', *, league_id: 'str' = '00') -> 'float'
WNBA home win probability (league_id='10'). See sportsdataverse.nba.nba_game_predict.win_prob_from_margin.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
exp_margin | float | ||
league_id | str | '00' |