Skip to main content

Package — additional Python functions — ESPN

xfl_pbp​

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

Enriched XFL play-by-play (EP/EPA/WP/WPA/CP/CPOE).

Fetches the ESPN game summary, unrolls its drives into an nflverse-shape frame, and scores it with the same parity-validated NFL EP/WP pipeline used league-wide (see sportsdataverse.football.spring_football_ep_wp).

Parameters

ParameterTypeDefaultDescription
game_idUnion[str, int]ESPN XFL event id.
return_as_pandasboolFalseWhen True, return a pandas.DataFrame.

Returns

One row per play with ep/epa/wp/wpa/cp/cpoe and the other enrich_nfl_pbp output columns. Zero rows for a game ESPN has no play-by-play for.

col_nametypedescription
defteamcharacter
defteam_scoreinteger
defteam_timeouts_remaininginteger
domeinteger
downinteger
game_halfcharacter
game_idcharacter
game_seconds_remainingdouble
half_seconds_remainingdouble
homeinteger
home_teamcharacter
outdoorsinteger
play_idcharacter
posteamcharacter
posteam_scoreinteger
posteam_timeouts_remaininginteger
receive_2h_kointeger
retractableinteger
roofcharacter
score_differentialinteger
seasoninteger
spread_linedouble
yardline_100integer
ydstogointeger
air_yardsdouble
kickoff_attemptinteger
play_typecharacter
qtrinteger
epdouble
td_probdouble
opp_td_probdouble
fg_probdouble
opp_fg_probdouble
safety_probdouble
opp_safety_probdouble
no_score_probdouble
epadouble
qb_epadouble
air_epadouble
yac_epadouble
comp_air_epadouble
comp_yac_epadouble
total_home_comp_air_epadouble
total_away_comp_air_epadouble
total_home_comp_yac_epadouble
total_away_comp_yac_epadouble
total_home_raw_air_epadouble
total_away_raw_air_epadouble
total_home_raw_yac_epadouble
total_away_raw_yac_epadouble
posteam_spreaddouble
elapsed_sharedouble
spread_timedouble
Diff_Time_Ratiodouble
wpdouble
vegas_wpdouble
home_wpdouble
away_wpdouble
def_wpdouble
vegas_home_wpadouble
vegas_wpadouble
wpadouble
air_wpadouble
yac_wpadouble
comp_air_wpadouble
comp_yac_wpadouble
total_home_comp_air_wpadouble
total_away_comp_air_wpadouble
total_home_comp_yac_wpadouble
total_away_comp_yac_wpadouble
total_home_raw_air_wpadouble
total_away_raw_air_wpadouble
total_home_raw_yac_wpadouble
total_away_raw_yac_wpadouble
cpdouble
cpoedouble
xpassdouble
pass_oedouble
xyac_epadouble
xyac_mean_yardagedouble
xyac_median_yardagedouble
xyac_successdouble
xyac_fddouble
home_opening_kickoffdouble
go_wpdouble
first_down_probdouble
wp_succeeddouble
wp_faildouble
fg_make_probdouble
make_fg_wpdouble
miss_fg_wpdouble
fg_wpdouble
punt_wpdouble
go_boostdouble
go_wp_diffdouble
punt_wp_diffdouble
fg_wp_diffdouble
fourth_down_recommendationcharacter

Example

from sportsdataverse.football.xfl import xfl_pbp

df = xfl_pbp("401517780")
print(df.select("play_id", "epa", "wp").head())