Skip to main content
Version: 0.0.72

WNBA — additional Python functions

Hand-written wrappers, loaders, and helpers in sportsdataverse.wnba not covered by the generated API-endpoint reference above.

Play-by-play, schedule & rosters

espn_wnba_game_officials(game_id: 'int', season: 'int | None' = None, *, raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame | dict[str, Any]'

Pull the officials assigned to a WNBA game.

See sportsdataverse.wbb.espn_wbb_game_officials for full documentation of the column set, the empty-frame fallback when ESPN ships no officials, and the raw / return_as_pandas flag semantics.

Parameters

ParameterTypeDefaultDescription
game_idintESPN WNBA event identifier (e.g. 401620238 for Game 1 of the 2024 WNBA Finals).
seasonint | NoneNoneSeason year (recorded as output column only).
rawboolFalseIf True, returns the parsed JSON dict before any flattening.
return_as_pandasboolFalseIf True, returns a pandas DataFrame; otherwise polars.

Returns

Polars (or pandas) DataFrame with the same columns documented in sportsdataverse.wbb.espn_wbb_game_officials. If raw=True, returns the raw response dict.

col_nametypedescription
game_idintegerUnique game identifier.
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
official_idcharacterUnique official / referee identifier.
first_namecharacterPlayer's first name.
last_namecharacterPlayer's last name.
full_namecharacterPlayer's full name.
display_namecharacterDisplay name.
position_idcharacterUnique position identifier.
position_namecharacterListed roster position ('Guard', 'Forward', 'Center').
position_display_namecharacterPosition display name.
orderintegerDisplay order within the result set.

Example

from sportsdataverse.wnba import espn_wnba_game_officials
refs = espn_wnba_game_officials(game_id=401620238, season=2024)
print(refs.shape)
refs.select(["full_name", "position_name", "order"]).head()

# Pandas round-trip

refs_pd = espn_wnba_game_officials(
game_id=401620238, season=2024, return_as_pandas=True
)
refs_pd[["full_name", "position_name"]].head()

# Inspect the raw ESPN payload (e.g. for fields not flattened)

payload = espn_wnba_game_officials(game_id=401620238, season=2024, raw=True)
list(payload.keys())[:8]

espn_wnba_player_stats(athlete_id: 'int', season: 'int', *, season_type: 'str' = 'regular', total: 'bool' = False, raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame | dict[str, Any]'

Pull a WNBA athlete's ESPN season stat line.

See sportsdataverse.wbb.espn_wbb_player_stats for full documentation of the wide return shape, the {category}_{stat} stat columns, the athlete / team metadata blocks, and the season_type / total parameters.

Parameters

ParameterTypeDefaultDescription
athlete_idintESPN WNBA athlete identifier (e.g. 3149391 for A'ja Wilson).
seasonintSeason year, used in the core-v2 path.
season_typestr'regular'"regular" (type 2) or "postseason" (type 3).
totalboolFalseForward-compat totals passthrough.
rawboolFalseIf True, returns the raw core-v2 statistics JSON dict.
return_as_pandasboolFalseIf True, returns a pandas DataFrame; else polars.

Returns

A single-row wide DataFrame (polars by default). When raw=True returns the raw statistics JSON dict. See sportsdataverse.wbb.espn_wbb_player_stats for the column layout.

col_nametypedescription
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
season_typecharacterSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).
totallogicalTotal.
athlete_idintegerUnique athlete identifier (ESPN).
athlete_uidcharacterESPN athlete UID (universal identifier).
athlete_guidcharacterESPN athlete GUID.
athlete_typecharacterAthlete type / class.
first_namecharacterPlayer's first name.
last_namecharacterPlayer's last name.
full_namecharacterPlayer's full name.
display_namecharacterDisplay name.
short_namecharacterShort display name.
weightdoublePlayer weight in pounds.
display_weightcharacterPlayer weight in display format (e.g. '180 lbs').
heightdoublePlayer height (string e.g. '6-2' or inches).
display_heightcharacterPlayer height in display format (e.g. '6-2').
ageintegerPlayer age (in years).
date_of_birthcharacterDate of birth (YYYY-MM-DD).
jerseycharacterJersey number worn by the player.
slugcharacterURL-safe identifier.
activelogicalTRUE if the row represents an active record (player / team / season).
position_idintegerUnique position identifier.
position_namecharacterListed roster position ('Guard', 'Forward', 'Center').
position_display_namecharacterPosition display name.
position_abbreviationcharacterPosition abbreviation ('G' / 'F' / 'C').
college_namecharacterCollege name.
status_idintegerStatus identifier.
status_namecharacterStatus label.
defensive_blocksdoubleShort for blocked shot, number of times when a defensive player legally deflects a field goal attempt from an offensive player.
defensive_defensive_reboundsdoubleThe number of times when the defense obtains the possession of the ball after a missed shot by the offense.
defensive_stealsdoubleThe number of times a defensive player forced a turnover by intercepting or deflecting a pass or a dribble of an offensive player.
defensive_avg_defensive_reboundsdoubleThe average defensive rebounds per game.
defensive_avg_blocksdoubleThe average blocks per game.
defensive_avg_stealsdoubleThe average steals per game.
defensive_avg48_defensive_reboundsdoublePlayer's defensive rebounds per 48 minutes of play, drawn from the defensive statistical category.
defensive_avg48_blocksdoublePlayer's blocked shots per 48 minutes of play, drawn from the defensive statistical category.
defensive_avg48_stealsdoublePlayer's steals per 48 minutes of play, drawn from the defensive statistical category.
general_disqualificationsdoubleThe number of times a player reached the foul limit.
general_flagrant_foulsdoubleThe number of fouls that the officials thought were unnecessary or excessive.
general_foulsdoubleThe number of times a player had illegal contact with the opponent.
general_ejectionsdoubleThe number of times a player or coach is removed from the game as a result of a serious offense.
general_technical_foulsdoubleThe number of times an player or coach was called for a technical foul (unsportsmanlike conduct or violations).
general_reboundsdoubleThe total number of rebounds (offensive and defensive).
general_vorpdoubleValue Over Replacement Player.
general_minutesdoubleThe total number of minutes played.
general_avg_minutesdoubleThe average number of minutes per game.
general_fantasy_ratingdoubleThe Fantasy Rating of a player.
general_nba_ratingdoubleGeneral nba rating.
general_plus_minusdoubleA player's estimated on-court impact on team performance measured in point differential per 100 possessions.
general_avg_reboundsdoubleThe average rebounds per game.
general_avg_foulsdoubleThe average fouls committed per game.
general_avg_flagrant_foulsdoubleThe average number of flagrant fouls per game.
general_avg_technical_foulsdoubleThe average number of technical fouls per game.
general_avg_ejectionsdoubleThe average ejections per game.
general_avg_disqualificationsdoubleThe average number of disqualifications per game.
general_assist_turnover_ratiodoubleThe average number of assists a player or team records per turnover.
general_steal_foul_ratiodoubleThe average number of steals a player or team records per foul committed.
general_block_foul_ratiodoubleThe average number of blocks a player or record per foul committed.
general_avg_team_reboundsdoubleThe average number of rebounds for a team per game.
general_total_reboundsdoubleThe total number of rebounds for a team or player.
general_total_technical_foulsdoubleThe total number of technical fouls for a team or player.
general_team_assist_turnover_ratiodoubleThe number of assists per turnover for a team.
general_steal_turnover_ratiodoubleThe number of steals per turnover.
general_avg48_reboundsdoublePlayer's total rebounds (offensive plus defensive) per 48 minutes of play, drawn from the general statistical category.
general_avg48_foulsdoublePlayer's personal fouls per 48 minutes of play, drawn from the general statistical category.
general_avg48_flagrant_foulsdoublePlayer's flagrant fouls per 48 minutes of play, drawn from the general statistical category.
general_avg48_technical_foulsdoublePlayer's technical fouls per 48 minutes of play, drawn from the general statistical category.
general_avg48_ejectionsdoublePlayer's ejections per 48 minutes of play, drawn from the general statistical category.
general_avg48_disqualificationsdoublePlayer's disqualifications (fouling out) per 48 minutes of play, drawn from the general statistical category.
general_games_playeddoubleGames Played.
general_games_starteddoubleThe number of games started by an athlete.
general_double_doubledoubleThe number of times double digit values were accumulated in 2 of the following categories: points, rebounds, assists, steals, and blocked shots.
general_triple_doubledoubleThe number of times double digit values were accumulated in 3 of the following categories: points, rebounds, assists, steals, and blocked shots.
offensive_assistsdoubleThe number of times a player who passes the ball to a teammate in a way that leads to a score by field goal, meaning that he or she was "assisting" in the basket. There is some judgment involved in deciding whether a passer should be credited with an assist.
offensive_field_goalsdoubleField Goal makes and attempts.
offensive_field_goals_attempteddoubleThe number of times a 2pt field goal was attempted.
offensive_field_goals_madedoubleThe number of times a 2pt field goal was made.
offensive_field_goal_pctdoubleThe ratio of field goals made to field goals attempted: FGM / FGA.
offensive_free_throwsdoubleFree Throw makes and attempts.
offensive_free_throw_pctdoubleThe ratio of free throws made to free throws attempted: FTM / FTA.
offensive_free_throws_attempteddoubleThe number of times a free throw was attempted.
offensive_free_throws_madedoubleThe number of times a free throw was made.
offensive_offensive_reboundsdoubleThe number of times when the offense obtains the possession of the ball after a missed shot.
offensive_pointsdoubleThe number of points scored.
offensive_turnoversdoubleThe number of times a player loses possession to the other team.
offensive_three_point_pctdoubleThe ratio of 3pt field goals made to 3pt field goals attempted: 3PM / 3PA.
offensive_three_point_field_goals_attempteddoubleThe number of times a 3pt field goal was attempted.
offensive_three_point_field_goals_madedoubleThe number of times a 3pt field goal was made.
offensive_total_turnoversdoubleThe number of turnovers plus team turnovers for the team.
offensive_points_in_paintdoubleThe amount of points scored in the area known as "the Paint"(the rectangle between the foul line and the baseline).
offensive_brick_indexdoubleHow many points a player costs his team with his shooting compared with the league average on a per-40-minute basis. ((52.8 - TS%) x (FGA + (FTA x 0.44))) / (Min/40) .
offensive_avg_field_goals_madedoubleThe average field goals made per game.
offensive_avg_field_goals_attempteddoubleThe average field goals attempted per game.
offensive_avg_three_point_field_goals_madedoubleThe average three point field goals made per game.
offensive_avg_three_point_field_goals_attempteddoubleThe average three point field goals attempted per game.
offensive_avg_free_throws_madedoubleThe average free throw shots made per game.
offensive_avg_free_throws_attempteddoubleThe average free throw shots attempted per game.
offensive_avg_pointsdoubleThe average number of points scored per game.
offensive_avg_offensive_reboundsdoubleThe average offensive rebounds per game.
offensive_avg_assistsdoubleThe average assists per game.
offensive_avg_turnoversdoubleThe average turnovers committed per game.
offensive_offensive_rebound_pctdoubleThe percentage of the number of times they obtain the possession of the ball after a missed shot.
offensive_estimated_possessionsdoubleAn estimation of the number of possessions for a team or player.
offensive_avg_estimated_possessionsdoubleThe average number of estimated possessions per game for a team or player.
offensive_points_per_estimated_possessionsdoubleThe number of points per estimated possession for a team or player.
offensive_avg_team_turnoversdoubleThe average number of turnovers for a team per game.
offensive_avg_total_turnoversdoubleThe average number of total turnovers for a team per game.
offensive_three_point_field_goal_pctdoubleThe ratio of 3pt field goals made to 3pt field goals attempted: 3PM / 3PA.
offensive_two_point_field_goals_madedoubleThe number of 2-point field goals made for a team or player.
offensive_two_point_field_goals_attempteddoubleThe number of 2-point field goals attempted for a team or player.
offensive_avg_two_point_field_goals_madedoubleThe number of 2-point field goals made per game for a team or player.
offensive_avg_two_point_field_goals_attempteddoubleThe number of 2-point field goals attempted per game for a team or player.
offensive_two_point_field_goal_pctdoubleThe percentage of 2-points fields goals made by a team or player.
offensive_shooting_efficiencydoubleThe efficiency with which a team or player shoots the basketball.
offensive_scoring_efficiencydoubleThe efficiency with which a team or player scores the basketball.
offensive_avg48_field_goals_madedoublePlayer's field goals made per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_field_goals_attempteddoublePlayer's field goal attempts per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_three_point_field_goals_madedoublePlayer's three-point field goals made per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_three_point_field_goals_attempteddoublePlayer's three-point field goal attempts per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_free_throws_madedoublePlayer's free throws made per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_free_throws_attempteddoublePlayer's free throw attempts per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_pointsdoublePlayer's points scored per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_offensive_reboundsdoublePlayer's offensive rebounds per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_assistsdoublePlayer's assists per 48 minutes of play, drawn from the offensive statistical category.
offensive_avg48_turnoversdoublePlayer's turnovers per 48 minutes of play, drawn from the offensive statistical category.
team_idintegerUnique team identifier.
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').
team_guidcharacterESPN team GUID.
team_slugcharacterURL-safe team identifier (e.g. 'lasvegas-aces' / 'aces').
team_locationcharacterTeam city or location string.
team_namecharacterFull team display name (e.g. 'Las Vegas Aces').
team_abbreviationcharacterShort team abbreviation (e.g. 'LAS').
team_display_namecharacterFull team display name.
team_short_display_namecharacterShort team display name (e.g. 'Aces').
team_colorcharacterTeam primary color (hex without leading '#').
team_alternate_colorcharacterTeam alternate color (hex without leading '#').
team_is_activelogicalTRUE if the team is currently active.
team_logo_hrefcharacterDefault team logo URL; team_detail = TRUE only.

Example

from sportsdataverse.wnba import espn_wnba_player_stats
df = espn_wnba_player_stats(athlete_id=3149391, season=2024)
df.select(["full_name", "team_display_name", "offensive_points"])

espn_wnba_schedule(dates=None, season_type=None, limit=500, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_wnba_schedule - look up the WNBA schedule for a given season

Parameters

ParameterTypeDefaultDescription
datesintNoneUsed to define different seasons. 2002 is the earliest available season.
season_typeintNone2 for regular season, 3 for post-season, 4 for off-season.
limitint500number of records to return, default: 500.
return_as_pandasFalse

Returns

Polars dataframe containing schedule dates for the requested season. Returns None if no games

col_nametypedescription
idcharacterUnique play identifcation number
uidcharacterESPN UID string.
datecharacterDate in YYYY-MM-DD format.
attendanceintegerReported attendance.
time_validlogicalWhether the start time is confirmed.
neutral_sitelogicalNeutral site.
conference_competitionlogicalConference competition.
play_by_play_availablelogicalWhether play-by-play data is available.
recentlogicalWhether the game is recent.
start_datecharacterStart date (YYYY-MM-DD).
broadcastcharacterBroadcast information string.
highlightsintegerGame highlight urls.
notes_typecharacterNotes type.
notes_headlinecharacterNotes headline.
broadcast_marketcharacterBroadcast market label (e.g. 'national', 'home').
broadcast_namecharacterBroadcast name.
type_idcharacterType identifier (numeric).
type_abbreviationcharacterPlay type abbreviation
venue_idcharacterUnique venue identifier.
venue_full_namecharacterVenue full name.
venue_address_citycharacterVenue address city.
venue_address_statecharacterVenue address state / region.
venue_indoorlogicalWhether the home venue is indoors.
status_clockdoubleGame clock in seconds.
status_display_clockcharacterStatus display clock.
status_periodintegerCurrent period.
status_type_idcharacterUnique identifier for status type.
status_type_namecharacterStatus type name.
status_type_statecharacterStatus state (pre/in/post).
status_type_completedlogicalWhether the game is complete.
status_type_descriptioncharacterStatus type description.
status_type_detailcharacterStatus type detail.
status_type_short_detailcharacterStatus type short detail.
format_regulation_periodsintegerFormat regulation periods.
home_idcharacterUnique identifier for home.
home_uidcharacterHome team's uid.
home_locationcharacterHome team's location.
home_namecharacterHome team display name.
home_abbreviationcharacterHome team's abbreviation.
home_display_namecharacterHome team display name.
home_short_display_namecharacterHome short display name.
home_colorcharacterHome team primary color hex.
home_alternate_colorcharacterColor code (hex) for home alternate.
home_is_activelogicalHome team's is active.
home_venue_idcharacterUnique identifier for home venue.
home_logocharacterHome team logo URL.
home_scorecharacterHome team score at the time of the play.
home_winnerlogicalWhether the home team won.
home_linescoreslistPeriod-by-period point totals for the home team, stored as a list of integer scores.
home_recordscharacterWin-loss record strings for the home team across relevant splits (e.g., overall, home/away, conference).
away_idcharacterUnique identifier for away.
away_uidcharacterAway team's uid.
away_locationcharacterAway team's location.
away_namecharacterAway team display name.
away_abbreviationcharacterAway team's abbreviation.
away_display_namecharacterAway team display name.
away_short_display_namecharacterAway short display name.
away_colorcharacterAway team primary color hex.
away_alternate_colorcharacterColor code (hex) for away alternate.
away_is_activelogicalAway team's is active.
away_venue_idcharacterUnique identifier for away venue.
away_logocharacterAway team logo URL.
away_scorecharacterAway team score at the time of the play.
away_winnerlogicalWhether the away team won.
away_linescoreslistPeriod-by-period point totals for the away team, stored as a list of integer scores.
away_recordscharacterWin-loss record strings for the away team across relevant splits (e.g., overall, home/away, conference).
game_idintegerUnique game identifier.
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
season_typeintegerSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).

Example

from sportsdataverse.wnba import espn_wnba_schedule
sched = espn_wnba_schedule(dates=20241011) # 2024 WNBA Finals Game 1
print(sched.shape)
sched.select(["game_id", "home_name", "away_name", "status_type_description"]).head()

# Pull a full regular season's worth of games

reg = espn_wnba_schedule(dates=2024, season_type=2, limit=500)
reg.group_by("status_type_description").len().sort("len", descending=True)

# Pandas round-trip for a single date

espn_wnba_schedule(dates=20241011, return_as_pandas=True).head()

espn_wnba_team_stats(team_id: 'int', season: 'int', *, raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'dict[str, pl.DataFrame] | dict[str, pd.DataFrame] | dict[str, Any]'

Pull ESPN team season stats for a WNBA team.

See sportsdataverse.wbb.espn_wbb_team_stats for full documentation of the return shape, the canonical three category keys ("Averages", "Totals", "Misc"), the per-category column set, and the "Other" fallback bucket.

Parameters

ParameterTypeDefaultDescription
team_idintESPN WNBA team identifier (e.g. 17 for the Las Vegas Aces).
seasonintSeason year, forwarded to ESPN as ?season=YYYY.
rawboolFalseIf True, returns the parsed JSON dict before any flattening.
return_as_pandasboolFalseIf True, returns a dict of pandas DataFrames; otherwise polars.

Returns

Dict with one DataFrame per stat category — see sportsdataverse.wbb.espn_wbb_team_stats for the full column / key documentation. If raw=True, returns the raw response dict.

Example

from sportsdataverse.wnba import espn_wnba_team_stats
frames = espn_wnba_team_stats(team_id=17, season=2024)
sorted(frames.keys()) # 'Averages', 'Totals', 'Misc' (plus optional 'Other')
frames["Averages"].head()

# Compare per-game and totals at a glance

avgs = frames["Averages"]
totals = frames["Totals"]
print(avgs.shape, totals.shape)
avgs.select(["games_played", "points_per_game", "rebounds_per_game"])

# Pandas round-trip

frames_pd = espn_wnba_team_stats(team_id=17, season=2024, return_as_pandas=True)
frames_pd["Misc"].head()

Dataset loaders

load_wnba_stats_lineups(seasons, return_as_pandas: 'bool' = False) -> 'pl.DataFrame'

Load season-level WNBA 5-man lineup statistics (deprecated).

Parameters

ParameterTypeDefaultDescription
seasonsan int or iterable of seasons.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per lineup-season-measure_type, stacked from the wnba_stats_leaguedash cube's lineups_{base, advanced} assets filtered to group_quantity == 5 — matching the old wnba_stats_lineups tag's 5-man-only, Base+Advanced-only coverage. Call the cube's lineups_* assets directly (unfiltered) for 2/3/4-man lineups or the other 4 measure types.

Example

from sportsdataverse.wnba import load_wnba_stats_lineups
df = load_wnba_stats_lineups(seasons=2026)
print(df.shape)

load_wnba_stats_player_season_stats(seasons, return_as_pandas: 'bool' = False) -> 'pl.DataFrame'

Load season-level WNBA player statistics (deprecated).

Parameters

ParameterTypeDefaultDescription
seasonsan int or iterable of seasons.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per player-season-measure_type, stacked from the wnba_stats_leaguedash cube's player_stats_* assets (Base/Advanced/Misc/Scoring/Usage/Defense — matches the old wnba_stats_player_season_stats tag's coverage; player-level Opponent/Four Factors are empty upstream and were never populated by either version).

Example

from sportsdataverse.wnba import load_wnba_stats_player_season_stats
df = load_wnba_stats_player_season_stats(seasons=2026)
print(df.shape)

# Pipeline next step (Advanced-only rows)

import polars as pl
adv = df.filter(pl.col("measure_type") == "Advanced")

load_wnba_stats_standings(seasons, return_as_pandas: 'bool' = False) -> 'pl.DataFrame'

Load season-level WNBA standings (deprecated).

Parameters

ParameterTypeDefaultDescription
seasonsan int or iterable of seasons.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per team-season, read from the wnba_stats_leaguedash cube's standings asset -- the same underlying leaguestandingsv3 endpoint/params as the old wnba_stats_standings tag, so this is close to a pure passthrough.

Example

from sportsdataverse.wnba import load_wnba_stats_standings
df = load_wnba_stats_standings(seasons=2026)
print(df.shape)

load_wnba_stats_team_season_stats(seasons, return_as_pandas: 'bool' = False) -> 'pl.DataFrame'

Load season-level WNBA team statistics (deprecated).

Parameters

ParameterTypeDefaultDescription
seasonsan int or iterable of seasons.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per team-season-measure_type, stacked from the wnba_stats_leaguedash cube's team_stats_* assets (Base/Advanced/Misc/Scoring/Defense/ Opponent — matches the old wnba_stats_team_season_stats tag's coverage; team-level Usage/Four Factors are empty upstream).

Example

from sportsdataverse.wnba import load_wnba_stats_team_season_stats
df = load_wnba_stats_team_season_stats(seasons=2026)
print(df.shape)

Utilities & helpers

most_recent_wnba_season()

most_recent_wnba_season - return the most recent (likely-completed) WNBA season year.

Returns the current calendar year if it's May or later (the WNBA regular season has tipped off), otherwise the previous calendar year.

Returns

Year (e.g. 2024) suitable for passing as a season argument to schedule / loader functions.

Example

from sportsdataverse.wnba import most_recent_wnba_season, espn_wnba_calendar
season = most_recent_wnba_season()
cal = espn_wnba_calendar(season=season)
print(season, cal.height)

Other

build_athlete_identity_lookup(rosters: 'dict[int | str, dict]') -> 'dict[str, dict[str, Any]]'

R build_athlete_identity_lookup: athlete_id -> identity from team rosters.

Parameters

ParameterTypeDefaultDescription
rostersdict[int | str, dict]Mapping of team_id -> that team's raw roster payload (wbb/team_rosters/json/{season}/{team_id}.json). NOTE: R walks raw$athletes directly here (no position-bucket unwrap, unlike the rosters dataset itself).

Returns

athlete_id (str) -> identity fields for helper_wbb_player_season_stats.

espn_wnba_teams(return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_wnba_teams - look up WNBA teams

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe containing teams for the requested league. This function caches by default, so if you want to refresh the data, use the command sportsdataverse.wnba.espn_wnba_teams.clear_cache().

col_nametypedescription
team_abbreviationcharacterShort team abbreviation (e.g. 'LAS').
team_alternate_colorcharacterTeam alternate color (hex without leading '#').
team_colorcharacterTeam primary color (hex without leading '#').
team_display_namecharacterFull team display name.
team_idcharacterUnique team identifier.
team_is_activelogicalTRUE if the team is currently active.
team_is_all_starlogicalTRUE if the row represents an All-Star team.
team_locationcharacterTeam city or location string.
team_logosintegerTeam logo metadata.
team_namecharacterFull team display name (e.g. 'Las Vegas Aces').
team_nicknamecharacterTeam nickname.
team_short_display_namecharacterShort team display name (e.g. 'Aces').
team_slugcharacterURL-safe team identifier (e.g. 'lasvegas-aces' / 'aces').
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').

Example

from sportsdataverse.wnba import espn_wnba_teams
teams = espn_wnba_teams()
print(teams.shape)
teams.select(["team_id", "team_abbreviation", "team_display_name"]).head()

# Find Las Vegas Aces (team_id 17)

teams.filter(__import__("polars").col("team_id") == "17").to_dicts()

# Refresh the cache (the call is ``lru_cache``'d)

espn_wnba_teams.cache_clear() # cached at function-level
teams_pd = espn_wnba_teams(return_as_pandas=True)

make_prob_by_context(ptshots: 'pl.DataFrame', *, return_as_pandas: 'bool' = False) -> "'dict[str, Union[pl.DataFrame, pd.DataFrame]]'"

Marginal FG% tables by defender distance and by shot clock.

The public API exposes defender-distance and shot-clock only as aggregate bucket tables (playerdashptshots), not per-shot fields, so this aggregates Σfgm/Σfga across players within each bucket.

Parameters

ParameterTypeDefaultDescription
ptshotsDataFrameThe stacked playerdashptshots fixture — one frame with a result_set tag (ClosestDefenderShooting / ShotClockShooting) plus bucket, fga, fgm.
return_as_pandasboolFalseReturn pandas DataFrames instead of polars.

Returns

{"defender": frame, "shot_clock": frame} each with rows per bucket (bucket, fga, fgm, fg_pct). Missing result sets return the zero-row schema.

Example

from sportsdataverse.nba.nba_shot_value import make_prob_by_context
tables = make_prob_by_context(ptshots)
tables["defender"].sort("fg_pct")

make_prob_joint(defender: 'pl.DataFrame', shot_clock: 'pl.DataFrame', overall_fg_pct: 'float', *, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

Independence-combined defender x shot-clock make probability.

Combines the two marginal FG% tables under a conditional-independence assumption via odds multipliers: odds(p) = p/(1-p); odds_joint = odds_overall * (odds_def/odds_overall) * (odds_clock/odds_overall); joint = odds_joint/(1+odds_joint). This assumes defender distance and shot-clock effects are independent given the league baseline — a simplification (a late clock correlates with tighter defense), documented here so callers weigh it.

Parameters

ParameterTypeDefaultDescription
defenderDataFrameThe "defender" marginal table from make_prob_by_context (bucket, fg_pct).
shot_clockDataFrameThe "shot_clock" marginal table (bucket, fg_pct).
overall_fg_pctfloatThe league overall FG% baseline.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per (close_def_dist_range, shot_clock_range): close_def_dist_range:Utf8, shot_clock_range:Utf8, joint_fg_pct:Float64. Empty inputs return the zero-row schema.

Example

from sportsdataverse.nba.nba_shot_value import make_prob_by_context, make_prob_joint
t = make_prob_by_context(ptshots)
joint = make_prob_joint(t["defender"], t["shot_clock"], 0.47)

score_shot_xpoints(shots: 'pl.DataFrame', league_avgs: 'pl.DataFrame', *, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

Score each shot with expected points from the league-average baseline.

Joins the per-shot frame to the zone baseline (falling back to the within-shot_zone_range mean when a zone triple is unmatched) and adds shot_value (3 for a 3PT shot else 2), xpoints = base_fg_pct * shot_value, and actual_points = shot_made_flag * shot_value.

Parameters

ParameterTypeDefaultDescription
shotsDataFramePer-shot Shot_Chart_Detail frame (needs shot_type + the three zone keys + shot_made_flag).
league_avgsDataFrameThe LeagueAverages frame (see xpoints_baseline).
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

The input shots plus shot_value:Int64, base_fg_pct:Float64, xpoints:Float64, actual_points:Float64. Empty input returns the augmented schema with zero rows.

Example

from sportsdataverse.nba.nba_shot_value import score_shot_xpoints
scored = score_shot_xpoints(shots, league_avgs)

# Pipeline next step (one line)

scored.group_by("player_id").agg(pl.col("xpoints").sum())

scoreboard_event_parsing(event)

No description available.

Parameters

ParameterTypeDefaultDescription
event

shooter_talent(scored_shots: 'pl.DataFrame', *, league_id: 'str' = '00', min_attempts: 'int' = 50, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

Regressed shooter true-talent: make%-above-expected, shrunk to the mean.

Aggregates score_shot_xpoints output per shooter and regresses the raw over-expected rate toward zero by n/(n+k) (k = get_shrinkage_k(league_id), fitted split-half). As-of leakage boundary: to score a shooter's talent for shots after date D, pass only that shooter's shots before D -- this function does not enforce the cut itself.

Parameters

ParameterTypeDefaultDescription
scored_shotsDataFramescore_shot_xpoints output (needs player_id, shot_made_flag, base_fg_pct, xpoints, actual_points).
league_idstr'00'"00" NBA, "10" WNBA, "20" G-League.
min_attemptsint50Drop shooters with fewer attempts (unstable estimate).
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per player_id: player_id:Int64, n_att:Int64, actual_makes:Int64, exp_makes:Float64, points_above_expected:Float64, raw_above_pct:Float64, talent_pct:Float64. Empty input returns the zero-row schema.

Example

from sportsdataverse.nba.nba_shot_value import score_shot_xpoints, shooter_talent
talent = shooter_talent(score_shot_xpoints(shots, league_avgs))

# Pipeline next step (one line)

talent.sort("talent_pct", descending=True).head(15)

shot_selection_quality(scored_shots: 'pl.DataFrame', *, min_attempts: 'int' = 50, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

Player shot-selection quality: mean expected value vs the league mean.

xev_per_shot is a player's mean xpoints (the value of the LOOKS they take, independent of makes); selection_quality is that minus the league-wide mean xpoints over the same frame -- a rim-and-three diet scores positive, a mid-range diet negative.

Parameters

ParameterTypeDefaultDescription
scored_shotsDataFramescore_shot_xpoints output (needs player_id, xpoints).
min_attemptsint50Drop players with fewer attempts.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per player_id: player_id:Int64, n_att:Int64, xev_per_shot:Float64, league_xev_per_shot:Float64, selection_quality:Float64. Empty input returns the zero-row schema.

Example

from sportsdataverse.nba.nba_shot_value import score_shot_xpoints, shot_selection_quality
sel = shot_selection_quality(score_shot_xpoints(shots, league_avgs))

# Pipeline next step (one line)

sel.sort("selection_quality", descending=True).head(15)

wnba_aging_curve(*, return_as_pandas: 'bool' = False) -> "'pl.DataFrame | pd.DataFrame'"

WNBA aging curve -- the NBA core bound to league="wnba".

See sportsdataverse.nba.nba_aging_curve.nba_aging_curve for the full contract; this is a by-reference re-export, same algorithm, women's bundled artifact.

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalse

Returns

Frame age:Int64, rel_value:Float64, peak_age:Float64.

Example

from sportsdataverse.wnba import wnba_aging_curve
curve = wnba_aging_curve()

wnba_availability(seasons: "'int | list[int]'", *, return_as_pandas: 'bool' = False) -> "'pl.DataFrame | pd.DataFrame'"

WNBA availability -- the NBA core bound to league="wnba".

See sportsdataverse.nba.nba_availability.nba_availability for the full contract; avail_pct is availability, not skill.

Parameters

ParameterTypeDefaultDescription
seasonsint | list[int]A season (start year) or list of seasons.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

Frame player_id:Utf8, season:Int64, avail_pct:Float64.

Example

from sportsdataverse.wnba import wnba_availability
proj = wnba_availability(2023)

wnba_career_trajectory(player_values: 'pl.DataFrame', *, return_as_pandas: 'bool' = False) -> "'pl.DataFrame | pd.DataFrame'"

WNBA career trajectory -- the NBA core bound to league="wnba".

See sportsdataverse.nba.nba_aging_curve.nba_career_trajectory for the full contract.

Parameters

ParameterTypeDefaultDescription
player_valuesDataFrameFrame player_id, age:Int64, value:Float64.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

player_values plus age_adjusted_value and proj_next_value.

Example

import polars as pl
from sportsdataverse.wnba import wnba_career_trajectory
player_values = pl.DataFrame({"player_id": ["1"], "age": [26], "value": [10.0]})
wnba_career_trajectory(player_values)

wnba_draft_model(draft_year: "'int | list[int]'", *, return_as_pandas: 'bool' = False) -> "'pl.DataFrame | pd.DataFrame'"

Project WNBA prospect career value + draft probability from draft slot.

Parameters

ParameterTypeDefaultDescription
draft_yearint | list[int]A draft year (e.g. 2023) or list of years.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

Frame player_id:Utf8, draft_year:Int64, proj_career_value:Float64, draft_prob:Float64, projected_pick:Int64, pro_tier:Utf8. Empty input returns the zero-row schema, never raises.

Example

from sportsdataverse.wnba import wnba_draft_model
board = wnba_draft_model(2023)

wnba_enhanced_pbp(game_id: 'str', *, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

Return a normalised enhanced play-by-play frame for a WNBA game.

Fetches the raw playbyplayv3 payload from stats.wnba.com via ~sportsdataverse.wnba.wnba_stats.wnba_stats_playbyplayv3 then delegates all transformation to the league-agnostic ~sportsdataverse.nba.nba_enhanced_pbp.enhanced_pbp_from_payload core with league_id="10". Never raises on malformed or empty payloads — returns a zero-row frame instead.

Parameters

ParameterTypeDefaultDescription
game_idstrWNBA game identifier string (e.g. "1022400001").
return_as_pandasboolFalseIf True, convert the result to a pandas.DataFrame before returning.

Returns

Polars (or pandas) DataFrame with schema sportsdataverse.nba.nba_enhanced_pbp.ENHANCED_PBP_SCHEMA. Key columns include game_id (Utf8), action_number (Int64), period (Int64), seconds_remaining (Float64), team_id (Int64), person_id (Int64), is_substitution (Boolean), and one Boolean flag per event type.

Example

from sportsdataverse.wnba.wnba_engine import wnba_enhanced_pbp
df = wnba_enhanced_pbp("1022400001")
print(df.shape)

# Pandas output

df_pd = wnba_enhanced_pbp("1022400001", return_as_pandas=True)
print(type(df_pd))

# Filter substitution events

subs = df.filter(df["is_substitution"] == True) # noqa: E712
print(subs.select(["period", "seconds_remaining", "person_id"]))

wnba_expected_turnovers(season: 'str', *, base: "'Optional[pl.DataFrame]'" = None, player_mix: "'Optional[pl.DataFrame]'" = None, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

WNBA expected turnovers / ball-security skill (league_id="10").

Thin wrapper binding sportsdataverse.nba.nba_expected_turnovers.nba_expected_turnovers to the women's league.

Parameters

ParameterTypeDefaultDescription
seasonstrSeason string, e.g. "2024".
baseOptional[DataFrame]NoneInjected nba_stats_leaguedashplayerstats (Base) frame.
player_mixOptional[DataFrame]NoneInjected Synergy player-level offensive mix.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

Same schema as sportsdataverse.nba.nba_expected_turnovers.nba_expected_turnovers.

Example

from sportsdataverse.wnba import wnba_expected_turnovers
t = wnba_expected_turnovers("2024")
print(t.sort("ball_security_skill", descending=True).head())

wnba_foul_drawing(season: 'str', *, base: "'Optional[pl.DataFrame]'" = None, advanced: "'Optional[pl.DataFrame]'" = None, player_mix: "'Optional[pl.DataFrame]'" = None, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

WNBA foul-drawing / FT-generation (league_id="10").

Thin wrapper binding sportsdataverse.nba.nba_foul_drawing.nba_foul_drawing to the women's league.

Parameters

ParameterTypeDefaultDescription
seasonstrSeason string, e.g. "2024".
baseOptional[DataFrame]NoneInjected nba_stats_leaguedashplayerstats (Base) frame.
advancedOptional[DataFrame]NoneInjected Advanced-measure frame.
player_mixOptional[DataFrame]NoneInjected Synergy player-level offensive mix.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

Same schema as sportsdataverse.nba.nba_foul_drawing.nba_foul_drawing.

Example

from sportsdataverse.wnba import wnba_foul_drawing
f = wnba_foul_drawing("2024")
print(f.sort("foul_draw_skill", descending=True).head())

wnba_in_game_win_prob(pbp: 'pl.DataFrame', pregame_home_prob: 'float', *, league_id: 'str' = '00', return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

WNBA in-game win probability (league_id='10'). See sportsdataverse.nba.nba_game_predict.nba_in_game_win_prob.

Parameters

ParameterTypeDefaultDescription
pbpDataFrame
pregame_home_probfloat
league_idstr'00'
return_as_pandasboolFalse

wnba_matchup_drapm(season: 'str', *, matchups: "'Optional[pl.DataFrame]'" = None, config: "'Optional[PlaytypeConfig]'" = None, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

WNBA matchup defensive RAPM (league_id="10").

Thin wrapper binding sportsdataverse.nba.nba_matchup_drapm.nba_matchup_drapm to the women's league.

Parameters

ParameterTypeDefaultDescription
seasonstrSeason string, e.g. "2024".
matchupsOptional[DataFrame]NoneInjected nba_stats_leagueseasonmatchups-shaped frame.
configOptional[PlaytypeConfig]None~sportsdataverse.nba.nba_playtype_constants.PlaytypeConfig override.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

Same schema as sportsdataverse.nba.nba_matchup_drapm.nba_matchup_drapm.

Example

from sportsdataverse.wnba import wnba_matchup_drapm
d = wnba_matchup_drapm("2024")
print(d.sort("matchup_drapm", descending=True).head())

wnba_on_court(game_id: 'str', *, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

Return the rotation-keyed on-court player frame for a WNBA game.

Makes three network calls (play-by-play v3, game rotation, box-score traditional v3), infers on-court rosters from the rotation stints via ~sportsdataverse.nba.nba_lineups.players_on_court_from_rotation, and returns one row per PBP action with ten Int64 player-ID columns (home_player_1..5 / away_player_1..5). All transformation is performed by the shared nba/ core with league_id="10" forwarded to the rotation endpoint. Never raises on malformed payloads.

Parameters

ParameterTypeDefaultDescription
game_idstrWNBA game identifier string (e.g. "1022400001").
return_as_pandasboolFalseIf True, convert the result to a pandas.DataFrame before returning.

Returns

Polars (or pandas) DataFrame with one row per PBP action and columns home_player_1home_player_5, away_player_1away_player_5 (all Int64), plus the action_number join key.

Example

from sportsdataverse.wnba.wnba_engine import wnba_on_court
oc = wnba_on_court("1022400001")
print(oc.select(["action_number", "home_player_1"]).head())

# Pandas output

oc_pd = wnba_on_court("1022400001", return_as_pandas=True)
print(type(oc_pd))

# Join on enhanced PBP

from sportsdataverse.wnba.wnba_engine import wnba_enhanced_pbp
enh = wnba_enhanced_pbp("1022400001")
joined = enh.join(oc, on="action_number", how="left")

wnba_pbp_disk(game_id, path_to_json)

No description available.

Parameters

ParameterTypeDefaultDescription
game_id
path_to_json

wnba_play_context(game_id: 'str', *, transition_seconds: 'float' = 6.0, transition_variant: 'str' = 'hoop_math', return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

Return a WNBA game's possessions with the full CTG play-context surface.

WNBA sibling of ~sportsdataverse.nba.nba_play_context.nba_play_context — the Cleaning the Glass recreation (possession start-type taxonomy + the halfcourt / transition / putback contexts + CTG's garbage-time and heave filters). One network call (playbyplayv3 on stats.wnba.com); every transformation is done by the league-agnostic ~sportsdataverse.nba.nba_play_context.add_play_context core, so there is no WNBA-specific classification logic to drift.

Two caveats worth stating plainly:

  • CTG is NBA-only. There is no published WNBA play-context table to calibrate against, so transition_seconds inherits the NBA's fitted 6.0 s default. The WNBA fixtures land inside the NBA's transition-frequency gate at that value (tests/wnba/test_wnba_play_context_shim.py), which is a sanity check on the shared engine — not evidence that 6.0 s is the right WNBA cutoff. Re-fit it if a WNBA oracle ever appears.
  • Shot-zone boundaries are league-agnostic (feet from the rim), and the corner-three test uses the same legacy coordinates, which the WNBA feed also ships.

Parameters

ParameterTypeDefaultDescription
game_idstrWNBA game identifier (e.g. "1022400001").
transition_secondsfloat6.0Transition initial-play cutoff, in seconds.
transition_variantstr'hoop_math'See ~sportsdataverse.nba.nba_play_context.add_transition.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

The possession frame (POSSESSIONS_SCHEMA) plus ~sportsdataverse.nba.nba_play_context.PLAY_CONTEXT_POSSESSIONS_SCHEMA. Empty or malformed payloads return a zero-row frame — never raises on payload content.

Example

from sportsdataverse.wnba.wnba_engine import wnba_play_context
poss = wnba_play_context("1022400001")
print(poss["possession_start_type_ctg"].value_counts())

# Transition rate (CTG's default filtered view)

import polars as pl
clean = poss.filter(
(pl.col("is_garbage_time") == False) # noqa: E712
& (pl.col("is_heave_possession") == False) # noqa: E712
)
print(clean["is_transition"].mean())

wnba_player_props(season: 'int', game_id: 'str', home_team_id: 'str', away_team_id: 'str', *, league_id: 'str' = '00', return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

WNBA player props (league_id='10'). See sportsdataverse.nba.nba_player_props.nba_player_props.

Parameters

ParameterTypeDefaultDescription
seasonint
game_idstr
home_team_idstr
away_team_idstr
league_idstr'00'
return_as_pandasboolFalse

wnba_playtype_ratings(season: 'str', *, off_team: "'Optional[pl.DataFrame]'" = None, def_team: "'Optional[pl.DataFrame]'" = None, schedule: "'Optional[pl.DataFrame]'" = None, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

WNBA Synergy play-type-adjusted offense/defense (league_id="10").

Thin wrapper binding sportsdataverse.nba.nba_playtype.nba_playtype_ratings to the women's league. Synergy coverage is sparse for the WNBA; an empty upstream fetch degrades to a zero-row frame (never raises).

Parameters

ParameterTypeDefaultDescription
seasonstrSeason string, e.g. "2024".
off_teamOptional[DataFrame]NoneInjected Synergy offensive team frame (bypasses the live fetch).
def_teamOptional[DataFrame]NoneInjected Synergy defensive team frame.
scheduleOptional[DataFrame]NoneInjected team_id/opp_team_id schedule frame.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

Same schema as sportsdataverse.nba.nba_playtype.nba_playtype_ratings.

Example

from sportsdataverse.wnba import wnba_playtype_ratings
r = wnba_playtype_ratings("2024")
print(r.sort("adj_off", descending=True).head())

wnba_possessions(game_id: 'str', *, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

Return the possession-level lineup stint matrix for a WNBA game.

Builds possessions from the enhanced PBP via ~sportsdataverse.nba.nba_possessions.build_possessions, resolves on-court rosters via ~sportsdataverse.nba.nba_lineups.players_on_court_from_rotation, then attaches the 5v5 lineups via ~sportsdataverse.nba.nba_possessions.attach_possession_lineups. All transformation is performed by the shared nba/ cores — no WNBA- specific logic. Never raises on malformed payloads.

Parameters

ParameterTypeDefaultDescription
game_idstrWNBA game identifier string (e.g. "1022400001").
return_as_pandasboolFalseIf True, convert the result to a pandas.DataFrame before returning.

Returns

Polars (or pandas) DataFrame with schema combining POSSESSIONS_SCHEMA and ten lineup columns: off_player_1off_player_5, def_player_1def_player_5 (all Int64). One row per possession. Empty or malformed inputs return a zero-row frame.

Example

from sportsdataverse.wnba.wnba_engine import wnba_possessions
poss = wnba_possessions("1022400001")
print(poss.shape)

# Pandas output

poss_pd = wnba_possessions("1022400001", return_as_pandas=True)
print(type(poss_pd))

# Total points check

total = int(poss["points"].sum())
print(f"Total points scored: {total}")

wnba_predict_games(games: 'pl.DataFrame', ratings: 'pl.DataFrame', *, league_id: 'str' = '00', return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'

WNBA vectorized pregame predictions (league_id='10'). See sportsdataverse.nba.nba_game_predict.nba_predict_games.

Parameters

ParameterTypeDefaultDescription
gamesDataFrame
ratingsDataFrame
league_idstr'00'
return_as_pandasboolFalse

wnba_predict_margin(home_net: 'float', away_net: 'float', *, home_pace: 'float', away_pace: 'float', neutral: 'bool' = False, league_id: 'str' = '00') -> 'float'

WNBA expected margin (league_id='10'). See sportsdataverse.nba.nba_game_predict.predict_margin.

Parameters

ParameterTypeDefaultDescription
home_netfloat
away_netfloat
home_pacefloat
away_pacefloat
neutralboolFalse
league_idstr'00'

wnba_predict_total(home_off: 'float', home_def: 'float', away_off: 'float', away_def: 'float', home_pace: 'float', away_pace: 'float', *, league_id: 'str' = '00') -> 'float'

WNBA expected total (league_id='10'). See sportsdataverse.nba.nba_game_predict.predict_total.

Parameters

ParameterTypeDefaultDescription
home_offfloat
home_deffloat
away_offfloat
away_deffloat
home_pacefloat
away_pacefloat
league_idstr'00'

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

ParameterTypeDefaultDescription
game_idsSequence[str]Sequence of WNBA game identifier strings.
return_as_pandasboolFalseIf 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_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

ParameterTypeDefaultDescription
draft_yearint | list[int]A draft year or list of years.
return_as_pandasboolFalseReturn 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_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

ParameterTypeDefaultDescription
player_idslist[int]Player ids to fetch.
seasonstrSeason string, e.g. "2024".
include_contextboolFalseAlso fetch + return the playerdashptshots defender/shot-clock context tables.
return_as_pandasboolFalseReturn 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(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

ParameterTypeDefaultDescription
seasonint
league_idstr'00'
return_as_pandasboolFalse

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

ParameterTypeDefaultDescription
seasonsUnion[int, list[int]]
league_idstr'00'
as_of_dateUnion[date, None]None
return_as_pandasboolFalse

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

ParameterTypeDefaultDescription
seasonsint | str | listA single season or list of seasons.
league_idstr'10'Defaults to "10" (WNBA); pass "20" here for G-League.
per_modestr'Totals'per_mode_simple passed to the fetch (default "Totals").
by_positionboolTrueCompute the baseline within role buckets (default); False forces one league-wide bucket.
positionsOptional[DataFrame]NoneOptional pre-fetched positions frame.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.
_get_fnOptional[Callable[..., dict]]NoneInjectable 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(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

ParameterTypeDefaultDescription
seasonsint | str | listA single season or list of seasons.
league_idstr'10'Defaults to "10" (WNBA); pass "20" here for G-League.
per_modestr'Totals'per_mode_simple passed to the fetch (default "Totals").
by_positionboolTrueCompute the baseline within role buckets (default); False forces one league-wide bucket.
positionsOptional[DataFrame]NoneOptional pre-fetched positions frame.
fetch_potential_assistsboolFalseEnrich the top passers with playerdashptpass potential-assist counts.
max_playersint0Cap on per-player enrichment fetches; 0 disables enrichment regardless of fetch_potential_assists.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.
_get_fnOptional[Callable[..., dict]]NoneInjectable replacement for nba_stats_leaguedashptstats.
_pass_get_fnOptional[Callable[..., dict]]NoneInjectable 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(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

ParameterTypeDefaultDescription
seasonsint | str | listA single season or list of seasons.
league_idstr'10'Defaults to "10" (WNBA); pass "20" here for G-League.
per_modestr'Totals'per_mode_simple passed to the fetch (default "Totals").
by_positionboolTrueCompute the baseline within role buckets (default); False forces one league-wide bucket.
positionsOptional[DataFrame]NoneOptional pre-fetched positions frame.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.
_get_fnOptional[Callable[..., dict]]NoneInjectable 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(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

ParameterTypeDefaultDescription
seasonsint | str | listA single season or list of seasons.
league_idstr'10'Defaults to "10" (WNBA); pass "20" here for G-League.
per_modestr'Totals'per_mode_simple passed to the fetch (default "Totals").
by_positionboolTrueCompute the baseline within role buckets (default); False forces one league-wide bucket.
positionsOptional[DataFrame]NoneOptional pre-fetched positions frame.
sourcestr'leaguedash'"leaguedash" (default) or "shotdefend".
max_playersint0Cap on per-player shotdefend enrichment fetches; ignored unless source="shotdefend".
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.
_get_fnOptional[Callable[..., dict]]NoneInjectable replacement for nba_stats_leaguedashptstats.
_defend_get_fnOptional[Callable[..., dict]]NoneInjectable 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(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

ParameterTypeDefaultDescription
seasonsint | str | listA single season or list of seasons.
league_idstr'10'Defaults to "10" (WNBA); pass "20" here for G-League.
per_modestr'Totals'per_mode_simple passed to each fetch (default "Totals").
by_positionboolTrueCompute each measure's baseline within role buckets (default); False forces one league-wide bucket.
positionsOptional[DataFrame]NoneOptional pre-fetched positions frame.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.
_get_fnOptional[Callable[..., dict]]NoneInjectable 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(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

ParameterTypeDefaultDescription
seasonsint | str | listA single season or list of seasons.
league_idstr'10'Defaults to "10" (WNBA); pass "20" here for G-League.
per_modestr'Totals'per_mode_simple passed to the fetch (default "Totals").
by_positionboolTrueCompute the baseline within role buckets (default); False forces one league-wide bucket.
positionsOptional[DataFrame]NoneOptional pre-fetched positions frame.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.
_get_fnOptional[Callable[..., dict]]NoneInjectable 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(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

ParameterTypeDefaultDescription
exp_marginfloat
league_idstr'00'

zone_value_map(scored_shots: 'pl.DataFrame', *, return_as_pandas: 'bool' = False) -> "'Union[pl.DataFrame, pd.DataFrame]'"

Per-player per-zone value map: points and expected points per shot.

Collapses shot_zone_basic to a canonical zone via ZONE_COLLAPSE (the two corner-3 zones merge) and aggregates realized vs expected points per shot in each zone.

Parameters

ParameterTypeDefaultDescription
scored_shotsDataFramescore_shot_xpoints output (needs player_id, shot_zone_basic, shot_made_flag, actual_points, xpoints).
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per (player_id, zone): player_id:Int64, zone:Utf8, att:Int64, makes:Int64, pts:Float64, pps:Float64, xpps:Float64, pps_above_expected:Float64 (pps = points per shot, xpps = expected). Empty input returns the zero-row schema.

Example

from sportsdataverse.nba.nba_shot_value import score_shot_xpoints, zone_value_map
zmap = zone_value_map(score_shot_xpoints(shots, league_avgs))

# Pipeline next step (one line)

zmap.filter(pl.col("zone") == "corner_3").sort("pps_above_expected", descending=True)