Skip to main content
Version: main

MBB — additional Python functions

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

Play-by-play, schedule & rosters

espn_mbb_game_rosters(game_id: 'int', raw=False, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_mbb_game_rosters() - Pull the game by id.

Parameters

ParameterTypeDefaultDescription
game_idintUnique game_id, can be obtained from mbb_schedule().
rawFalse
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe of game roster data with columns: 'athlete_id', 'athlete_uid', 'athlete_guid', 'athlete_type', 'first_name', 'last_name', 'full_name', 'athlete_display_name', 'short_name', 'weight', 'display_weight', 'height', 'display_height', 'age', 'date_of_birth', 'slug', 'jersey', 'linked', 'active', 'alternate_ids_sdr', 'birth_place_city', 'birth_place_state', 'birth_place_country', 'headshot_href', 'headshot_alt', 'experience_years', 'experience_display_value', 'experience_abbreviation', 'status_id', 'status_name', 'status_type', 'status_abbreviation', 'hand_type', 'hand_abbreviation', 'hand_display_value', 'draft_display_text', 'draft_round', 'draft_year', 'draft_selection', 'player_id', 'starter', 'valid', 'did_not_play', 'display_name', 'ejected', 'athlete_href', 'position_href', 'statistics_href', 'team_id', 'team_guid', 'team_uid', 'team_slug', 'team_location', 'team_name', 'team_nickname', 'team_abbreviation', 'team_display_name', 'team_short_display_name', 'team_color', 'team_alternate_color', 'is_active', 'is_all_star', 'team_alternate_ids_sdr', 'logo_href', 'logo_dark_href', 'game_id'

col_nametypedescription
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.
athlete_display_namecharacterAthlete display name (full).
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).
slugcharacterURL-safe identifier.
jerseycharacterJersey number worn by the player.
linkedlogicalTRUE if the record is linked to a related entity.
activelogicalTRUE if the row represents an active record (player / team / season).
alternate_ids_sdrcharacterAlternate ids sdr.
birth_place_citycharacterBirth place city.
birth_place_statecharacterBirth place state.
birth_place_countrycharacterBirth place country.
birth_country_alternate_idcharacter
birth_country_abbreviationcharacterBirth country abbreviation.
headshot_hrefcharacterHeadshot image URL.
headshot_altcharacterAlternative-text label for the headshot.
flag_hrefcharacter
flag_altcharacter
flag_relcharacter
experience_yearsintegerExperience years.
experience_display_valuecharacterExperience display value.
experience_abbreviationcharacterExperience abbreviation.
status_idcharacterStatus identifier.
status_namecharacterStatus label.
status_typecharacterStatus type.
status_abbreviationcharacterStatus abbreviation.
hand_typecharacterHand type.
hand_abbreviationcharacterHand abbreviation.
hand_display_valuecharacterHand display value.
starterlogicalTRUE if the player was in the starting lineup; FALSE otherwise.
jersey_rightcharacter
validlogicalValid.
did_not_playlogicalTRUE if the player did not appear in the game.
display_namecharacterDisplay name.
ejectedlogicalTRUE if the player was ejected from the game.
athlete_hrefcharacter
position_hrefcharacter
statistics_hrefcharacter
team_idintegerUnique team identifier.
orderintegerDisplay order within the result set.
home_awaycharacterGame venue label ('home' or 'away').
winnerlogicalWinner.
team_guidcharacterESPN team GUID.
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').
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_nicknamecharacterTeam nickname.
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 '#').
is_activelogicalIs active.
is_all_starlogicalIs all star.
team_alternate_ids_sdrcharacter
logo_hrefcharacterTeam or league logo URL.
logo_dark_hrefcharacterLogo URL for dark backgrounds.
game_idintegerUnique game identifier.

Example

from sportsdataverse.mbb import espn_mbb_game_rosters
roster = espn_mbb_game_rosters(game_id=401638637)
print(roster.shape)

# Identify starters

import polars as pl
starters = roster.filter(pl.col("starter") == True).select(
["full_name", "jersey", "team_display_name"]
)

# Pandas round-trip

roster_pd = espn_mbb_game_rosters(game_id=401638637, return_as_pandas=True)
roster_pd.head()

espn_mbb_pbp(game_id: 'int', raw=False, **kwargs) -> 'Dict'

espn_mbb_pbp() - Pull the game by id. Data from API endpoints: mens-college-basketball/playbyplay, mens-college-basketball/summary

Parameters

ParameterTypeDefaultDescription
game_idintUnique game_id, can be obtained from mbb_schedule().
rawboolFalseIf True, returns the raw json from the API endpoint. If False, returns a cleaned dictionary of datasets.

Returns

Dictionary of game data with keys: "gameId", "plays", "winprobability", "boxscore", "header", "broadcasts", "videos", "playByPlaySource", "standings", "leaders", "timeouts", "pickcenter", "againstTheSpread", "odds", "predictor", "espnWP", "gameInfo", "season"

Example

from sportsdataverse.mbb import espn_mbb_pbp
game = espn_mbb_pbp(game_id=401638637)
print(game["gameId"])
print(len(game["plays"]))

# Filter shooting plays for a basic shot chart

import polars as pl
plays = pl.DataFrame(game["plays"])
shots = plays.filter(pl.col("shooting_play") == True)
shots.select(
[
"period_number",
"clock_display_value",
"team_id",
"coordinate_x",
"coordinate_y",
"score_value",
"text",
]
).head()

# Convert to pandas

import pandas as pd
plays_pd = pd.DataFrame(game["plays"])
plays_pd[plays_pd["shooting_play"] == True].head()

# Raw payload (skip the cleaning pipeline) for debugging

raw = espn_mbb_pbp(game_id=401638637, raw=True)
sorted(raw.keys())

espn_mbb_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 men's-college-basketball 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. For the richer web-v3 payload use sportsdataverse.mbb.espn_mbb_player_stats_v3.

Parameters

ParameterTypeDefaultDescription
athlete_idintESPN men's-college-basketball athlete identifier.
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.

col_nametypedescription
seasonintegerSeason year.
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').
agecharacterPlayer 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_turnover_pointsdoubleThe amount of points resulting from the possession following a turnover.
defensive_avg_defensive_reboundsdoubleThe average defensive rebounds per game.
defensive_avg_blocksdoubleThe average blocks per game.
defensive_avg_stealsdoubleThe average steals per game.
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_perdoubleA numerical value for each of a player's accomplishments per-minute and is pace-adjusted for the team they play on. The league average in PER to 15.00 every season.
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_minutesdoubleThe total number of minutes played.
general_avg_minutesdoubleThe average number of minutes per game.
general_fantasy_ratingdoubleThe Fantasy Rating of a player.
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_steal_turnover_ratiodoubleThe number of steals per turnover.
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_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_second_chance_pointsdouble
offensive_fast_break_pointsdoubleThe number of points scored on fast breaks.
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.
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.mbb import espn_mbb_player_stats
df = espn_mbb_player_stats(athlete_id=4395624, season=2023)
df.select(["full_name", "team_display_name", "offensive_points"])

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

espn_mbb_schedule - look up the men's college basketball scheduler for a given season

Parameters

ParameterTypeDefaultDescription
datesintNoneUsed to define different seasons. 2002 is the earliest available season.
groupsint50Used to define different divisions. 50 is Division I, 51 is Division II/Division III.
season_typeintNone2 for regular season, 3 for post-season, 4 for off-season.
limitint500number of records to return, default: 500.
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

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

col_nametypedescription
idcharacterId.
uidcharacterESPN UID string.
datecharacterDate in YYYY-MM-DD format.
attendanceintegerReported attendance.
time_validlogicalTime valid.
neutral_sitelogicalNeutral site.
conference_competitionlogicalConference competition.
play_by_play_availablelogicalWhether play-by-play data is available.
recentlogicalRecent.
tournament_idintegerESPN tournament identifier.
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_abbreviationcharacterType abbreviation.
venue_idcharacterUnique venue identifier.
venue_full_namecharacterVenue full name.
venue_address_citycharacterVenue address city.
venue_address_statecharacterVenue address state / region.
venue_indoorlogicalTRUE if the venue is indoors.
status_clockdoubleStatus clock.
status_display_clockcharacterStatus display clock.
status_periodintegerStatus period.
status_type_idcharacterUnique identifier for status type.
status_type_namecharacterStatus type name.
status_type_statecharacterStatus type state.
status_type_completedlogicalStatus type completed.
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 name.
home_abbreviationcharacterHome team's abbreviation.
home_display_namecharacterHome display name.
home_short_display_namecharacterHome short display name.
home_colorcharacterColor code (hex) for home.
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_conference_idcharacterUnique identifier for home conference.
home_scorecharacterHome team score at the time of the play.
home_winnerlogicalHome team's winner.
home_current_rankinteger
home_linescoresinteger
home_recordscharacter
away_idcharacterUnique identifier for away.
away_uidcharacterAway team's uid.
away_locationcharacterAway team's location.
away_namecharacterAway name.
away_abbreviationcharacterAway team's abbreviation.
away_display_namecharacterAway display name.
away_short_display_namecharacterAway short display name.
away_colorcharacterColor code (hex) for away.
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_conference_idcharacterUnique identifier for away conference.
away_scorecharacterAway team score at the time of the play.
away_winnerlogicalAway team's winner.
away_current_rankinteger
away_linescoresinteger
away_recordscharacter
game_idintegerUnique game identifier.
seasonintegerSeason year.
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.mbb import espn_mbb_schedule
day = espn_mbb_schedule(dates=20240408)
print(day.shape)

# Season-level pull (2024 season)

season = espn_mbb_schedule(dates=2024, limit=1500)
print(season.shape)

# Filter to a specific team (Duke ``team_id=150``)

import polars as pl
duke = season.filter(
(pl.col("home_id") == "150") | (pl.col("away_id") == "150")
)

# Pandas round-trip

season_pd = espn_mbb_schedule(dates=2024, return_as_pandas=True)
season_pd.head()

Utilities & helpers

most_recent_mbb_season()

Return the most recent men's college basketball season year.

The men's college basketball season spans early November through early April; for any month October-December the "current season" is the following calendar year (e.g. October 2025 returns 2026).

Returns

The most recent / current season year.

Example

from sportsdataverse.mbb import most_recent_mbb_season, espn_mbb_schedule
season = most_recent_mbb_season()
sched = espn_mbb_schedule(dates=season)

Other

espn_mbb_teams(groups=None, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_mbb_teams - look up the men's college basketball teams

Parameters

ParameterTypeDefaultDescription
groupsintNoneUsed to define different divisions. 50 is Division I, 51 is Division II/Division III.
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.mbb.espn_mbb_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.mbb import espn_mbb_teams
teams = espn_mbb_teams()
print(teams.shape)
print(teams.columns[:8])

# Walk every team-id (handy for batched scrapes)

team_ids = teams["team_id"].to_list()
print(len(team_ids), "D1 teams")

# Pandas round-trip + Division II/III

d2_d3 = espn_mbb_teams(groups=51, return_as_pandas=True)
d2_d3.head()

fox_mbb_boxscore(game_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB boxscore (long: one row per player-stat).

Parameters

ParameterTypeDefaultDescription
game_idUnion[int, str]Fox Bifrost event id.
return_parsedboolTrueIf True (default) flatten the per-team stat tables to long form; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_boxscore
df = fox_mbb_boxscore("...")

fox_mbb_league_leaders(category: 'str' = 'scoring', who: 'str' = 'player', page: 'int' = 0, *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB statistical leaders (stats-con); who=player|team.

Parameters

ParameterTypeDefaultDescription
categorystr'scoring'Stat category. Defaults to "scoring".
whostr'player'"player" or "team". Defaults to "player".
pageint00-based result page. Defaults to 0.
return_parsedboolTrueIf True (default) flatten the leader tables to a DataFrame; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_league_leaders
df = fox_mbb_league_leaders("scoring")

fox_mbb_odds(game_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB game odds six-pack (spread / to-win / total per team).

Parameters

ParameterTypeDefaultDescription
game_idUnion[int, str]Fox Bifrost event id.
return_parsedboolTrueIf True (default) flatten the six-pack market to a DataFrame; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_odds
df = fox_mbb_odds("...")

fox_mbb_pbp(game_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB play-by-play (one row per play; period-based).

Parameters

ParameterTypeDefaultDescription
game_idUnion[int, str]Fox Bifrost event id.
return_parsedboolTrueIf True (default) flatten the pbp layout to a DataFrame; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_pbp
df = fox_mbb_pbp("...")

fox_mbb_standings(team_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB standings for a team's conference/division.

Parameters

ParameterTypeDefaultDescription
team_idUnion[int, str]Fox Bifrost team id.
return_parsedboolTrueIf True (default) flatten the standings tables to a DataFrame; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_standings
df = fox_mbb_standings("...")

fox_mbb_team_gamelog(team_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB team game log (long: one row per game-stat).

Parameters

ParameterTypeDefaultDescription
team_idUnion[int, str]Fox Bifrost team id.
return_parsedboolTrueIf True (default) flatten to long form; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_team_gamelog
df = fox_mbb_team_gamelog("...")

fox_mbb_team_roster(team_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB team roster (one row per player).

Parameters

ParameterTypeDefaultDescription
team_idUnion[int, str]Fox Bifrost team id.
return_parsedboolTrueIf True (default) flatten the position-group tables to a DataFrame; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_team_roster
df = fox_mbb_team_roster("...")

fox_mbb_team_stats(team_id: 'Union[int, str]', *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "Union[pl.DataFrame, 'pd.DataFrame', Dict[str, Any]]"

MBB team stat leaders by category.

Parameters

ParameterTypeDefaultDescription
team_idUnion[int, str]Fox Bifrost team id.
return_parsedboolTrueIf True (default) flatten the leader sections to a DataFrame; if False return the raw JSON dict.
return_as_pandasboolFalseIf True return a pandas DataFrame; otherwise polars. Ignored when return_parsed=False.

Returns

A polars DataFrame (default), a pandas DataFrame when return_as_pandas=True, or the raw JSON dict when return_parsed=False.

Example

from sportsdataverse.mbb import fox_mbb_team_stats
df = fox_mbb_team_stats("...")

mbb_pbp_disk(game_id, path_to_json)

No description available.

Parameters

ParameterTypeDefaultDescription
game_id
path_to_json

scoreboard_event_parsing(event)

No description available.

Parameters

ParameterTypeDefaultDescription
event