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.

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: league, season, game_id, date, exhibition, conference, playoffs, championship, home_team, away_team, home_score, away_score, game_link.

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:

  league   season        game_id        date  exhibition  ...     home_team    away_team  home_score away_score                                          game_link
0  fball  2009-10  20090829_5s7o  2009-08-29       False  ...           ubc  simonfraser           1          0  https://en.usports.ca/sports/fball/2009-10/box...
1  fball  2009-10  20090903_i7gc  2009-09-03       False  ...      montreal       mcgill          66         14  https://en.usports.ca/sports/fball/2009-10/box...
2  fball  2009-10  20090904_w209  2009-09-04       False  ...       alberta          ubc          24         25  https://en.usports.ca/sports/fball/2009-10/box...
3  fball  2009-10  20090904_veg9  2009-09-04       False  ...    sherbrooke      bishops          25         20  https://en.usports.ca/sports/fball/2009-10/box...
4  fball  2009-10  20090904_apij  2009-09-04       False  ...  saskatchewan      calgary          20         20  https://en.usports.ca/sports/fball/2009-10/box...

[5 rows x 13 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, team, team_status, return_type, number, yards, average, longest, touchdowns, player_links, date, sport, link, game_id, season.

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          team team_status      return_type  number  ...        date  sport                                               link        game_id   season
0  Alexander-Amour  Saint Mary's        away  kickoff_returns       1  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1  Shedler Fervius  Saint Mary's        away  kickoff_returns       1  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2    Zacchary Kuhn          StFX        home  kickoff_returns       2  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
3     Isaac Fagnan          StFX        home  kickoff_returns       2  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
4  Shedler Fervius  Saint Mary's        away     punt_returns       5  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20

[5 rows x 15 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, team, team_status, passing_completions, passing_attempts, passing_yards, passing_longest, passing_touchdowns, passing_interceptions, passing_rtg, rushing_attempts, rushing_yards, rushing_average, rushing_longest, rushing_touchdowns, receiving_receptions, receiving_yards, receiving_average, receiving_longest, receiving_touchdowns, fumble_number, fumbles_lost, player_links, date, sport, link, game_id, season.

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          team team_status  passing_completions  passing_attempts  ...        date  sport                                               link        game_id   season
0      Josh Shim  Saint Mary's        away                 15.0              16.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1  Avery Clayton  Saint Mary's        away                 11.0              15.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2       Zee Rana  Saint Mary's        away                  2.0               5.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
3      JJ Stairs  Saint Mary's        away                  0.0               1.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
4  Bailey Wasdal          StFX        home                  6.0               8.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20

[5 rows x 28 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: number, player, solo, sack_assists, total, sacks, sack_yards, tackles_for_loss, tackles_for_loss_yards, forced_fumbles, fumble_recovery, fumble_recovery_yards_gained, interceptions, interception_yards_gained, passes_broken_up, blocked_kicks, quarterback_hurries, team, player_links, date, sport, link, game_id, season.

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  sack_assists  total  ...        date  sport                                               link        game_id   season
0     47     Brandon Kohls     4             2    5.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1     99  Adrien Grant Jr.     2             5    4.5  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2     24      Dustin Magee     4             0    4.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
3      6     Jean-Loescher     3             1    3.5  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
4     29     Adrian Greene     3             0    3.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20

[5 rows x 24 columns]

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, team, team_status, action_type, field_goals_made, field_goals_attempted, longest, extra_points_made, extra_points_attempted, return_yards, points, number, yards, average, touchbacks, inside_20, out_of_bounds, player_links, date, sport, link, game_id, season.

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          team team_status action_type  field_goals_made  ...        date  sport                                               link        game_id   season
0   Brian Hope  Saint Mary's        away     kicking               2.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1  William Fay          StFX        home     kicking               NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2   Brian Hope  Saint Mary's        away    kickoffs               NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
3  William Fay          StFX        home    kickoffs               NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
4   Brian Hope  Saint Mary's        away     punting               NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20

[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: down, drive_start, yards_for_next_down, yardline, side_of_field, description, quarter, team, drive_id, kick, kickoff, punt, pass_complete, pass_incomplete, rush, sack, fumble, fumble_forced, touchdown, timeout, penalty, intercepted, fumble_recovered, rouge_point, date, sport, link, game_id, season.

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:

   down  drive_start yards_for_next_down yardline  side_of_field  ...        date  sport                                               link        game_id   season
0   1.0          NaN                  10      SMU           45.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1   1.0          NaN                  10      SMU           45.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2   NaN          NaN                 NaN      NaN            NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
3   NaN        900.0                 NaN      NaN            NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
4   1.0        900.0                  10     STFX           21.0  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20

[5 rows x 29 columns]

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, team, player, yards, play_type, extra_points, passer, away_score, home_score, date, sport, link, game_id, season.

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          team                              player  yards  ...        date  sport                                               link        game_id   season
0  1.0   555  Saint Mary's                          Brian Hope  27 yd  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1  1.0   299  Saint Mary's                          Brian Hope    NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2  2.0   865  Saint Mary's  Brian Hope field goal attempt from    NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
3  2.0    14  Saint Mary's  Brian Hope field goal attempt from    NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
4  3.0   635  Saint Mary's  Brian Hope field goal attempt from    NaN  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20

[5 rows x 15 columns]

fb_get_drive_summaries

Fetches the Football drive 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 drive summaries. The columns of the returned DataFrame are: team, quarter, start, possessions, began, plays, yards, result, drive_id, date, sport, link, game_id, season, drive_start.

Example:

from usportspy import fb_get_drive_summaries

# Get drive summaries for male Football for seasons 2019 and 2021
drive_summaries = fb_get_drive_summaries("m", [2019, 2021])
print(drive_summaries.head())

Expected output:

           team  quarter  start possessions   began  plays  ...        date  sport                                               link        game_id   season drive_start
0          StFX      1.0  15:00        1:20  STFX21      2  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20         900
1  Saint Mary's      1.0  13:40        4:25   SMU52      7  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20         820
2          StFX      1.0  09:15        1:34  STFX35      2  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20         555
3  Saint Mary's      1.0  07:41        2:42   SMU27      6  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20         461
4          StFX      1.0  04:59        2:05  STFX35      3  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20         299

[5 rows x 15 columns]

fb_get_team

Fetches the Football team 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 team data. The columns of the returned DataFrame are: team, first_downs, passing, rushing, penalty, total_offense, total_offensive_plays, average_gain_per_play, net_yards_passing, completions, attempts, net_yards_per_pass_play, number_of_sacked, yards_lost_from_sacked, had_intercepted, net_yards_rushing, rushing_attempts, average_gain_per_rush, number_of_punts, yards_punted, average, total_return_yards, number_of_punt_returns, yards_from_punt_returns, number_of_kickoff_returns, yards_from_kickoff_returns, number_of_interception_returns, yards_from_interception_returns, number_of_penalties, yards_from_penalties, fumbles_number, fumbles_lost, number_of_sacks, yards_lost_from_sacks, number_of_interceptions, yards_from_interceptions, time_of_possession, date, sport, link, game_id, season.

Example:

from usportspy import fb_get_team

# Get team data for male Football for seasons 2019 and 2021
team_data = fb_get_team("m", [2019, 2021])
print(team_data.head())

Expected output:

           team  first_downs  passing  rushing  penalty  ...        date  sport                                               link        game_id   season
0  Saint Mary's           32       19        9        4  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
1          StFX           15        9        3        3  ...  2019-08-17  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190817_07mt  2019-20
2      Manitoba           18        7       10        1  ...  2019-08-21  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190821_lbks  2019-20
3        Regina           15        8        7        0  ...  2019-08-21  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190821_lbks  2019-20
4      Montreal           15        4       10        1  ...  2019-08-23  fball  https://en.usports.ca/sports/fball/2019-20/box...  20190823_doax  2019-20

[5 rows x 42 columns]