Skip to main content

Package — additional Python functions — stats.ncaa.org

college_softball_re24​

college_softball_re24(seasons: 'Union[int, List[int], None]' = None, *, state: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

sportsdataverse.baseball.college_run_expectancy.college_baseball_re24 fixed to league="college_softball".

Parameters

ParameterTypeDefaultDescription
seasonsUnion[int, List[int], None]NoneSee the core function.
stateOptional[DataFrame]NoneSee the core function.
return_as_pandasboolFalseReturn pandas.DataFrame instead of polars.

Returns

see the core function's Returns table.

col_nametypedescription
base_statecharacter3-char base occupancy code ("_" = empty, "1"/"2"/"3" = occupied), e.g. "1_3" for runners on first and third.
outsinteger
run_expectancydoubleEmpirical mean runs scored from this state through the end of the half-inning (RE24), fit on plate appearances outside the bottom of the 7th inning and later.
nintegerNumber of plate appearances observed starting in this base-out state, excluding the bottom of the 7th inning and later.

Example

from sportsdataverse.baseball.college_softball.college_softball_re import college_softball_state, college_softball_re24
state = college_softball_state(raw)
matrix = college_softball_re24(state=state)

college_softball_state​

college_softball_state(plays: 'Dict[str, Any]') -> 'pl.DataFrame'

sportsdataverse.baseball.college_run_expectancy.college_baseball_state fixed to league="college_softball".

Parameters

ParameterTypeDefaultDescription
playsDict[str, Any]Raw payload from espn_college_softball_game_plays(event_id, return_parsed=False).

Returns

see the core function's Returns table.

col_nametypedescription
game_idcharacter
inninginteger
halfcharacter
base_statecharacter
outsinteger
runs_beforeinteger
runs_afterinteger
batting_team_idcharacter
play_seqinteger
score_diffinteger

Example

from sportsdataverse.baseball.college_softball.college_softball_re import college_softball_state
state = college_softball_state(raw)

college_softball_wpa​

college_softball_wpa(seasons: 'Union[int, List[int], None]' = None, *, state: 'Optional[pl.DataFrame]' = None, results: 'Optional[pl.DataFrame]' = None, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

sportsdataverse.baseball.college_run_expectancy.college_baseball_wpa fixed to league="college_softball".

Parameters

ParameterTypeDefaultDescription
seasonsUnion[int, List[int], None]NoneSee the core function.
stateOptional[DataFrame]NoneSee the core function.
resultsOptional[DataFrame]NoneSee the core function.
return_as_pandasboolFalseReturn pandas.DataFrame instead of polars.

Returns

see the core function's Returns table.

col_nametypedescription
game_idcharacter
play_seqinteger0-based game-global plate-appearance order (sorted by ESPN atBatId); joins back to college_softball_state.
re_beforedoubleRE24 of the base-out state before the PA, looked up in the matrix fit on the same state frame; 0.0 when that state is absent from the matrix.
re_afterdoubleRE24 of the base-out state after the PA (the next PA's before-state in the same half-inning); 0.0 for the last PA of a half-inning.
run_valuedoublere_after minus re_before, plus runs scored on the play (change in the combined cumulative score).
wpadouble

Example

from sportsdataverse.baseball.college_softball.college_softball_re import college_softball_wpa
wpa = college_softball_wpa(state=state, results=results)