Field Hockey - uwaggs/usportspy GitHub Wiki
The usportspy
package provides functions to retrieve various data related to Field Hockey, including schedules, team and player box scores, and play-by-play data.
Fetches the schedule for Field Hockey games based on gender.
-
gender
(str): Must be"m"
or"w"
. Currently, only Women's data is available in U SPORTS.
-
pd.DataFrame
: A DataFrame containing the schedule for Field Hockey games. The columns of the returned DataFrame are: date, away, away_score, home, home_score, status, notes, month, box_scores, conference, division, exhibition, post_season, and season.
from usportspy import fh_get_schedule
# Get the schedule for female Field Hockey
schedule_female = fh_get_schedule("w")
print(schedule_female.head())
Expected ouptut:
date away away_score home home_score status ... box_scores conference division exhibition post_season season
0 Wed. 18 Western 0.0 Guelph 2.0 Final ... https://en.usports.ca/sports/fh/2023-24p/boxsc... 0 0 0 1 2023-24p
1 Sat. 21 Toronto 1.0 Waterloo 0.0 Final - 2OT ... https://en.usports.ca/sports/fh/2023-24p/boxsc... 0 0 0 1 2023-24p
2 Sat. 21 Guelph 1.0 York 3.0 Final ... https://en.usports.ca/sports/fh/2023-24p/boxsc... 0 0 0 1 2023-24p
3 Sat. 28 Toronto 0.0 York 0.0 Final - PS Away ... NaN 0 0 0 1 2023-24p
4 Fri. 3 Victoria 1.0 Toronto 1.0 Final - PS Home ... https://en.usports.ca/sports/fh/2023-24c/boxsc... 0 0 0 1 2023-24c
[5 rows x 14 columns]
Fetches the team box scores for Field Hockey games based on gender and seasons.
-
gender
(str): Must be"m"
or"w"
. Currently, only Women's data is available in U SPORTS. -
seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
-
pd.DataFrame
: A DataFrame containing the team box scores for the specified seasons. The columns of the returned DataFrame are: player, team, sh, sog, g, a, ds, min, yellow_card, red_card, game_id, sog_against, ga, sv, goalie_mins, game_date, season, and season_type.
from usportspy import fh_get_team_box_score
# Get team box scores for female Field Hockey for the 2018 and 2019 seasons
team_box_scores_female = fh_get_team_box_score("w", [2018, 2019])
print(team_box_scores_female.head())
Expected output:
player team sh sog g a ds min yellow_card red_card game_id sog_against ga sv goalie_mins game_date season season_type
0 Alycia Gray York 0 0 0 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
1 Amber Sandhu York 2 2 1 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
2 Anna Mollenhauer Victoria 3 0 0 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
3 Anso Hannes Victoria 1 0 0 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
4 Cara Butler Victoria 0 0 0 0 0 0 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
Fetches the player box scores for Field Hockey games based on gender and seasons.
-
gender
(str): Must be"m"
or"w"
. Currently, only Women's data is available in U SPORTS. -
seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
-
pd.DataFrame
: A DataFrame containing the player box scores for the specified seasons. The columns of the returned DataFrame are: player, team, sh, sog, g, a, ds, min, yellow_card, red_card, game_id, sog_against, ga, sv, goalie_mins, game_date, season, and season_type.
from usportspy import fh_get_player_box_score
# Get player box scores for female Field Hockey for the 2018 and 2019 seasons
player_box_scores_female = fh_get_player_box_score("w", [2018, 2019])
print(player_box_scores_female.head())
Expected output:
player team sh sog g a ds min yellow_card red_card game_id sog_against ga sv goalie_mins game_date season season_type
0 Alycia Gray York 0 0 0 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
1 Amber Sandhu York 2 2 1 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
2 Anna Mollenhauer Victoria 3 0 0 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
3 Anso Hannes Victoria 1 0 0 0 0 70 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
4 Cara Butler Victoria 0 0 0 0 0 0 0 0 20181102_31o6 NaN NaN NaN NaN NaN 2018-19 c
Fetches the play-by-play (PBP) data for Field Hockey games based on gender and seasons.
-
gender
(str): Must be"m"
or"w"
. Currently, only Women's data is available in U SPORTS. -
seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned.
-
pd.DataFrame
: A DataFrame containing the play-by-play data for the specified seasons. The columns of the returned DataFrame are: time, event, quarters, game_id, season, and season_type.
from usportspy import fh_get_pbp
# Get play-by-play data for female Field Hockey for the 2018 and 2019 seasons
pbp_female = fh_get_pbp("w", [2018, 2019])
print(pbp_female.head())
Expected output:
time event quarters game_id season season_type
0 0:00 Robin Fleming at goalie for Victoria. 1 20181102_31o6 2018-19 c
1 0:00 Alycia Gray at goalie for York. 1 20181102_31o6 2018-19 c
2 5:18 Penalty corner by York Sydney McFaul [5:18]. 1 20181102_31o6 2018-19 c
3 5:28 Shot by York Sara Vollmerhausen, Blocked. 1 20181102_31o6 2018-19 c
4 9:01 Shot by York Chloe Walton, Save (by goalie) Ro... 1 20181102_31o6 2018-19 c