Skip to main content

Women's college basketball — additional Python functions — Her Hoop Stats

has_herhoopstats_login​

has_herhoopstats_login() -> 'bool'

Whether Her Hoop Stats credentials are set in the environment.

Returns

True when both an e-mail and a password resolve from the environment.

Example

import pytest
from sportsdataverse.wbb import has_herhoopstats_login

pytestmark = pytest.mark.skipif(
not has_herhoopstats_login(), reason="no Her Hoop Stats login"
)

herhoopstats_login​

herhoopstats_login(email: 'Optional[str]' = None, password: 'Optional[str]' = None, *, proxy: 'Any' = None) -> 'requests.Session'

Log into herhoopstats.com and return the authenticated session.

The Python counterpart of wehoop's .hhs_login(). Optional -- every wrapper logs in on demand and reuses a cached session -- but it is the fastest way to verify credentials or a proxy before a long pull, and the returned session can be handed to a wrapper as session=.

Parameters

ParameterTypeDefaultDescription
emailOptional[str]NoneSubscription e-mail. Falls back to HERHOOPSTATS_EMAIL.
passwordOptional[str]NoneSubscription password. Falls back to HERHOOPSTATS_PW.
proxyAnyNoneProxy URL str or requests proxies= dict. Falls back to SDV_PY_HERHOOPSTATS_PROXY then SDV_PY_PROXY.

Returns

An authenticated requests.Session.

Raises

ExceptionDescription
RuntimeErrorWhen credentials cannot be resolved, or the site rejects them.

Example

from sportsdataverse.wbb import herhoopstats_login

session = herhoopstats_login(proxy="http://user:pw@proxy.example:8080")

herhoopstats_team_roster​

herhoopstats_team_roster(team_link: 'str', *, email: 'Optional[str]' = None, password: 'Optional[str]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame'

The player roster table from one Her Hoop Stats team page.

Port of wehoop's hhs_team_roster(): picks the table carrying a player / name column. A page without one has no roster: it answers a zero-row frame with the roster columns, never another table (wehoop falls back to the tallest table).

Parameters

ParameterTypeDefaultDescription
team_linkstrA team page path or full URL.
emailOptional[str]NoneSubscription e-mail; falls back to HERHOOPSTATS_EMAIL.
passwordOptional[str]NoneSubscription password; falls back to HERHOOPSTATS_PW.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per player. A zero-row frame with the roster columns when the page carried no roster.

col_nametypedescription
playerStringPlayer name.
gInt64Games played.
gsInt64Games started.
minFloat64Minutes played.
ptsFloat64Points scored.
trbFloat64Career total rebounds.
astFloat64Assists.
tovFloat64Turnovers.
stlFloat64Steals.
blkFloat64Blocks.
fg_pctStringField goal percentage (0-1).
ft_pctStringFree throw percentage (0-1).
2_p_pctString
3_p_pctString

Raises

ExceptionDescription
RuntimeErrorWhen credentials cannot be resolved or are rejected.
AssetFetchErrorThe fetch failed, or the page was the free-tier teaser (the session expired or the subscription lapsed), never returned as data.

Example

from sportsdataverse.wbb import herhoopstats_team_roster

roster = herhoopstats_team_roster("/stats/ncaa/team/12345/2024/")

herhoopstats_team_stats​

herhoopstats_team_stats(team_link: 'str', *, email: 'Optional[str]' = None, password: 'Optional[str]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'Dict[str, pl.DataFrame | pd.DataFrame]'

Every table on one Her Hoop Stats team page.

Port of wehoop's hhs_team_stats(), which keeps only the tallest table. This returns all of them keyed by the table's HTML id (else caption, else position), so a single fetch covers the whole page.

Parameters

ParameterTypeDefaultDescription
team_linkstrA team page path or full URL -- e.g. a link taken from the team-page column of herhoopstats_teams.
emailOptional[str]NoneSubscription e-mail; falls back to HERHOOPSTATS_EMAIL.
passwordOptional[str]NoneSubscription password; falls back to HERHOOPSTATS_PW.
return_as_pandasboolFalseReturn pandas.DataFrame values instead of polars.

Returns

{table_key: DataFrame}; empty when the page carried no data table.

Raises

ExceptionDescription
RuntimeErrorWhen credentials cannot be resolved or are rejected.
AssetFetchErrorThe fetch failed, or the page was the free-tier teaser (the session expired or the subscription lapsed), never returned as data.

Example

from sportsdataverse.wbb import herhoopstats_team_stats

tables = herhoopstats_team_stats("/stats/ncaa/team/12345/2024/")
list(tables)

herhoopstats_teams​

herhoopstats_teams(min_season: 'int', max_season: 'Optional[int]' = None, division: 'int' = 1, *, email: 'Optional[str]' = None, password: 'Optional[str]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame'

NCAA women's team single-season summary table.

Port of wehoop's hhs_teams(). One row per team-season (record, scoring, per-100-possession columns), with the requested min_season / max_season / division attached so concatenated pulls stay traceable.

Parameters

ParameterTypeDefaultDescription
min_seasonintFirst season, as a 4-digit ENDING year (2024 = 2023-24).
max_seasonOptional[int]NoneLast season, same convention. Defaults to min_season.
divisionint1NCAA division -- 1 (default), 2 or 3.
emailOptional[str]NoneSubscription e-mail; falls back to HERHOOPSTATS_EMAIL.
passwordOptional[str]NoneSubscription password; falls back to HERHOOPSTATS_PW.
return_as_pandasboolFalseReturn a pandas.DataFrame instead of polars.

Returns

One row per team-season, plus a team_link column carrying each team's page path -- the only way to reach herhoopstats_team_stats / herhoopstats_team_roster. A zero-row frame when nothing matched.

col_nametypedescription
seasonStringSeason identifier (4-digit year or 'YYYY-YY' string).
teamStringTeam-side label or team identifier.
gInt64Games played.
wInt64Wins.
lInt64Losses.
win_pctStringWin percentage (0-1 decimal).
ptsFloat64Points scored.
opp_ptsFloat64Opponent points.
net_ptsFloat64
off_rtgFloat64
def_rtgFloat64
net_rtgFloat64
paceFloat64Possessions per 48 minutes.
team_linkString
min_seasonInt64
max_seasonInt64
divisionInt64Team division.

Raises

ExceptionDescription
RuntimeErrorWhen credentials cannot be resolved or are rejected.
AssetFetchErrorThe fetch failed, or the page was the free-tier teaser (the session expired or the subscription lapsed), never returned as data.

Example

from sportsdataverse.wbb import herhoopstats_teams

teams = herhoopstats_teams(min_season=2024, division=1)

# Multiple seasons, through a proxy

teams = herhoopstats_teams(2022, 2024, proxy="http://127.0.0.1:8888")