Football - uwaggs/usportspy GitHub Wiki
Football Module
The usportspy
package provides functions to retrieve Football-related data, including game schedules, team and player statistics, and more. Currently, only Men's Football data is available.
Functions
fb_get_schedule
Fetches the Football schedule based on gender.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.
Returns:
pd.DataFrame
: A DataFrame containing the Football schedule. The columns of the returned DataFrame are: Date, Away, Away_score, Home, home_score, Status, Notes, Month, box_scores, conference, division, Exhibition, PostSeason, and season.
Example:
from usportspy import fb_get_schedule
# Get the schedule for male Football
schedule_male = fb_get_schedule("m")
print(schedule_male.head())
Expected output:
Date Away Away_score Home home_score Status ... box_scores conference division Exhibition PostSeason season
0 Sat. 2 RSEQ 4 NaN RSEQ #1 NaN 12:00 PM EDT ... NaN 0 0 1 1 2024-25p
1 Sat. 2 RSEQ 3 NaN RSEQ #2 NaN 3:00 PM EDT ... NaN 0 0 1 1 2024-25p
2 Sat. 9 SF Winners NaN Higher seed NaN 1:00 PM EST ... NaN 0 0 0 0 2024-25p
3 Sat. 11 Team West 16.0 Team East 1.0 Final ... https://en.usports.ca/sports/fball/2024-25/box... 0 0 1 0 2024-25
4 Sat. 17 StFX NaN Mount Allison NaN 2:00 PM ADT ... NaN 0 0 1 0 2024-25
[5 rows x 14 columns]
fb_get_returns
Fetches the Football returns data for specified seasons.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
Returns:
pd.DataFrame
: A DataFrame containing the Football returns data. The columns of the returned DataFrame are: player, punting_returns_no, punting_returns_yds, punting_returns_avg, punting_returns_lg, punting_returns_td, kickoff_returns_no, kickoff_returns_yds, kickoff_returns_avg, kickoff_returns_lg, kickoff_returns_td, interception_returns_no, interception_returns_yds, interception_returns_avg, interception_returns_lg, interception_returns_td, team, game_id, season, and season_type.
Example:
from usportspy import fb_get_returns
# Get returns data for male Football for seasons 2019 and 2021
returns_data = fb_get_returns("m", [2019, 2021])
print(returns_data.head())
Expected output:
player punting_returns_no punting_returns_yds punting_returns_avg punting_returns_lg punting_returns_td ... interception_returns_lg interception_returns_td team game_id season season_type
0 Tyrell Ford 4.0 49.0 12.3 39.0 0.0 ... NaN NaN Waterloo 20191026_u0mq 2019-20 p
1 Brandon Metz 2.0 6.0 3.0 6.0 0.0 ... NaN NaN Waterloo 20191026_u0mq 2019-20 p
2 Kalem Beaver 1.0 8.0 8.0 8.0 0.0 ... NaN NaN Ottawa 20191026_u0mq 2019-20 p
3 Tyler Ternowski NaN NaN NaN NaN NaN ... NaN NaN Waterloo 20191026_u0mq 2019-20 p
4 Jacob Beukeboom NaN NaN NaN NaN NaN ... NaN NaN Waterloo 20191026_u0mq 2019-20 p
[5 rows x 20 columns]
fb_get_offence
Fetches the Football offence data for specified seasons.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
Returns:
pd.DataFrame
: A DataFrame containing the Football offence data. The columns of the returned DataFrame are: player, c_a, passing_yds, passing_lg, passing_td, passing_int, rtg, rushing_att, rushing_yds, rushing_avg, rushing_lg, rushing_td, receiving_no, receiving_yds, receiving_avg, receiving_lg, receiving_td, fumble_no, fumble_lost, team, game_id, season, and season_type.
Example:
from usportspy import fb_get_offence
# Get offence data for male Football for seasons 2019 and 2021
offence_data = fb_get_offence("m", [2019, 2021])
print(offence_data.head())
Expected output:
player c_a passing_yds passing_lg passing_td passing_int rtg rushing_att rushing_yds ... receiving_avg receiving_lg receiving_td fumble_no fumble_lost team game_id season season_type
0 Tre Ford 16-24 225.0 45.0 2.0 1.0 NaN 15.0 122.0 ... NaN NaN NaN 1.0 0.0 Waterloo 20191026_u0mq 2019-20 p
1 Mitchell Baker 1-1 7.0 7.0 0.0 0.0 NaN 2.0 -11.0 ... NaN NaN NaN 2.0 0.0 Waterloo 20191026_u0mq 2019-20 p
2 Matt Mahler 21-35 286.0 37.0 1.0 2.0 NaN 3.0 17.0 ... NaN NaN NaN 1.0 0.0 Ottawa 20191026_u0mq 2019-20 p
3 Dion Pellerin NaN NaN NaN NaN NaN NaN 13.0 72.0 ... NaN NaN NaN NaN NaN Waterloo 20191026_u0mq 2019-20 p
4 Nicklas Sua NaN NaN NaN NaN NaN NaN 6.0 13.0 ... NaN NaN NaN NaN NaN Waterloo 20191026_u0mq 2019-20 p
[5 rows x 23 columns]
fb_get_defence
Fetches the Football defence data for specified seasons.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
Returns:
pd.DataFrame
: A DataFrame containing the Football defence data. The columns of the returned DataFrame are: player, solo, ast, total, sack, syds, tfl, tflyds, ff, fr, fryds, int, intyds, br_up, blks, qbh, team, game_id, season, and season_type.
Example:
from usportspy import fb_get_defence
# Get defence data for male Football for seasons 2019 and 2021
defence_data = fb_get_defence("m", [2019, 2021])
print(defence_data.head())
Expected output:
number player solo ast total sacks sacks_yds tfl tfl_yds ff fr fr_yds int int_yds br_up blks qbh team game_id season season_type
0 1 D. Jupiter-Dean 5 2 6.0 0.0 0.0 0.0 0 0 0 0 1 0 0 0 0 Waterloo 20191026_u0mq 2019-20 p
1 30 Tyrell Ford 3 3 4.5 0.0 0.0 0.0 0 0 0 0 0 0 1 0 0 Waterloo 20191026_u0mq 2019-20 p
2 8 Jethro Oleko 4 0 4.0 0.0 0.0 0.0 0 0 0 0 0 0 0 0 0 Waterloo 20191026_u0mq 2019-20 p
3 46 Kurtis Gray 3 1 3.5 2.0 9.0 2.0 9 0 0 0 1 75 1 0 0 Waterloo 20191026_u0mq 2019-20 p
4 99 Joshua Brown 3 1 3.5 0.0 0.0 0.0 0 0 0 0 0 0 1 0 0 Waterloo 20191026_u0mq 2019-20 p
fb_get_kicking
Fetches the Football kicking data for specified seasons.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
Returns:
pd.DataFrame
: A DataFrame containing the Football kicking data. The columns of the returned DataFrame are: player, punting_no, punting_yds, punting_avg, punting_lg, punting_tb, in_20, kicking_fga, kicking_fgm, kicking_lg, kicking_xpa, kicking_xpm, kicking_rg, kicking_pts, kickoffs_no, kickoffs_yds, kickoffs_avg, kickoffs_tb, kickoffs_ob, team, game_id, season, and season_type.
Example:
from usportspy import fb_get_kicking
# Get kicking data for male Football for seasons 2019 and 2021
kicking_data = fb_get_kicking("m", [2019, 2021])
print(kicking_data.head())
Expected output:
player punting_no punting_yds punting_avg punting_lg punting_tb in_20 kicking_fga ... kickoffs_yds kickoffs_avg kickoffs_tb kickoffs_ob team game_id season season_type
0 J. Zlatinszky 4.0 134.0 33.5 55.0 0.0 1.0 1 ... 381.0 54.4 0.0 1.0 Waterloo 20191026_u0mq 2019-20 p
1 Loic Legendre 6.0 217.0 36.2 45.0 0.0 0.0 0 ... NaN NaN NaN NaN Ottawa 20191026_u0mq 2019-20 p
2 Campbell Fair NaN NaN NaN NaN NaN NaN 2 ... 94.0 31.3 0.0 0.0 Ottawa 20191026_u0mq 2019-20 p
3 Vincent Plouffe 10.0 421.0 42.1 77.0 0.0 1.0 2 ... 241.0 60.3 0.0 0.0 Carleton 20191026_1yum 2019-20 p
4 Eric Stranz 11.0 424.0 38.5 50.0 1.0 1.0 2 ... 172.0 57.3 0.0 0.0 Guelph 20191026_1yum 2019-20 p
[5 rows x 23 columns]
fb_get_pbp
Fetches the Football play-by-play data for specified seasons.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
Returns:
pd.DataFrame
: A DataFrame containing the Football play-by-play data. The columns of the returned DataFrame are: downs, event, quarter, game_id, away_team, home_team, season, and season_type.
Example:
from usportspy import fb_get_pbp
# Get play-by-play data for male Football for seasons 2019 and 2021
pbp_data = fb_get_pbp("m", [2019, 2021])
print(pbp_data.head())
Expected output:
downs event quarter game_id away_team home_team season season_type
0 1st and 10 at WAT45 Ottawa won coin toss, Ottawa defers, Waterloo ... 1 20191026_u0mq Waterloo Ottawa 2019-20 p
1 1st and 10 at WAT45 OTT ball on OTT45. 1 20191026_u0mq Waterloo Ottawa 2019-20 p
2 NaN Campbell Fair kickoff 47 yards to the WAT18, T... 1 20191026_u0mq Waterloo Ottawa 2019-20 p
3 Waterloo at 15:00 Waterloo at 15:00 1 20191026_u0mq Waterloo Ottawa 2019-20 p
4 1st and 10 at WAT35 Tre Ford pass complete to G. Lam for 7 yards t... 1 20191026_u0mq Waterloo Ottawa 2019-20 p
fb_get_scoring_summaries
Fetches the Football scoring summaries for specified seasons.
Parameters:
gender
(str): Must be"m"
or"w"
. Note that only Men's data is currently available.seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
Returns:
pd.DataFrame
: A DataFrame containing the Football scoring summaries. The columns of the returned DataFrame are: prd, time, scoring_summary, away_score, home_score, away_team, home_team, game_id, season, and season_type.
Example:
from usportspy import fb_get_scoring_summaries
# Get scoring summaries for male Football for seasons 2019 and 2021
scoring_summaries = fb_get_scoring_summaries("m", [2019, 2021])
print(scoring_summaries.head())
Expected output:
prd time scoring_summary away_score home_score away_team home_team game_id season season_type
0 1 11:19 Waterloo - Tre Ford 7 yd run. (J. Zlatinszky k... 7 0 Waterloo Ottawa 20191026_u0mq 2019-20 p
1 2 10:07 Waterloo - D. Pellerin 5 yd run. (J. Zlatinszk... 14 0 Waterloo Ottawa 20191026_u0mq 2019-20 p
2 2 05:49 Ottawa - Campbell Fair 28 yd field goal. Drive... 14 3 Waterloo Ottawa 20191026_u0mq 2019-20 p
3 2 02:19 Ottawa - J. Britton-Bail 3 yd run. (Campbell F... 14 10 Waterloo Ottawa 20191026_u0mq 2019-20 p
4 2 00:17 Ottawa - Campbell Fair 26 yd field goal. Drive... 14 13 Waterloo Ottawa 20191026_u0mq 2019-20 p