Volleyball - uwaggs/usportspy GitHub Wiki

Volleyball Functions

The usportspy package includes functions to retrieve volleyball-related data, such as schedules, team box scores, player box scores, and play-by-play data.

Functions

volleyball_get_schedule

Fetches the volleyball schedule for the specified gender.

Parameters:

  • gender (str): Specifies the gender of the teams. Must be either "m" or "w".

Returns:

  • pd.DataFrame: A DataFrame containing the volleyball 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 volleyball_get_schedule

# Get the schedule for male teams
male_schedule = volleyball_get_schedule("m")
print(male_schedule.head())

# Get the schedule for female teams
female_schedule = volleyball_get_schedule("w")
print(female_schedule.head())

Expected output:

      date       away  away_score             home  home_score  ... conference division exhibition postseason    season
0  Wed. 21  Nipissing         3.0         Waterloo         2.0  ...          0        0          0          1  2023-24p
1  Thu. 22   Manitoba         3.0          Alberta         2.0  ...          0        0          0          1  2023-24p
2  Thu. 22    Brandon         0.0  Trinity Western         3.0  ...          0        0          0          1  2023-24p
3  Fri. 23        UNB         2.0            Laval         3.0  ...          0        0          0          1  2023-24p
4  Fri. 23   Montreal         1.0       Sherbrooke         3.0  ...          0        0          0          1  2023-24p

[5 rows x 14 columns]


      date             away  away_score          home  home_score        status  ... box_scores conference division  exhibition  postseason   season
0  Sat. 28              UNB         NaN        Acadia         NaN   7:00 PM ADT  ...        NaN          0        0           1           0  2024-25
1  Fri. 18          Alberta         NaN           UFV         NaN  12:00 PM PDT  ...        NaN          1        0           0           0  2024-25
2  Fri. 18           Regina         NaN  Saskatchewan         NaN   6:00 PM CDT  ...        NaN          1        0           0           0  2024-25
3  Fri. 18  Trinity Western         NaN       MacEwan         NaN   5:00 PM MDT  ...        NaN          1        0           0           0  2024-25
4  Fri. 18         Manitoba         NaN       Calgary         NaN   6:00 PM MDT  ...        NaN          1        0           0           0  2024-25

[5 rows x 14 columns]

volleyball_get_team_box_score

Fetches the team box score data for volleyball teams over specified seasons.

Parameters:

  • gender (str): Specifies the gender of the teams. Must be either "m" or "w".
  • 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 team box scores. The columns of the returned DataFrame are: set, k, e, ta, pct, team_name, game_id, date_time, points, season, and season_type.

Example:

from usportspy import volleyball_get_team_box_score

# Get team box scores for male teams for the 2019 and 2021 seasons
male_team_box_score = volleyball_get_team_box_score("m", [2019, 2021])
print(male_team_box_score.head())

# Get team box scores for female teams for the 2019 and 2021 seasons
female_team_box_score = volleyball_get_team_box_score("w", [2019, 2021])
print(female_team_box_score.head())

Expected output:

   set   k  e  ta    pct team_name        game_id              date_time  points   season season_type
0    1   8  1  14  0.500   Brandon  20200220_io53  2/20/2020  at 7:00 PM      25  2019-20           p
1    2  13  3  23  0.435   Brandon  20200220_io53  2/20/2020  at 7:00 PM      25  2019-20           p
2    3  11  1  21  0.476   Brandon  20200220_io53  2/20/2020  at 7:00 PM      25  2019-20           p
3    1   9  8  25  0.040   Calgary  20200220_io53  2/20/2020  at 7:00 PM      20  2019-20           p
4    2   9  3  18  0.333   Calgary  20200220_io53  2/20/2020  at 7:00 PM      17  2019-20           p


   set   k  e  ta    pct     team_name        game_id              date_time  points   season season_type
0    1  14  5  41  0.220  Saint Mary's  20200220_296h  2/20/2020  at 7:00 PM      25  2019-20           p
1    2  10  2  35  0.229  Saint Mary's  20200220_296h  2/20/2020  at 7:00 PM      25  2019-20           p
2    3  11  8  50  0.060  Saint Mary's  20200220_296h  2/20/2020  at 7:00 PM      24  2019-20           p
3    4  12  4  34  0.235  Saint Mary's  20200220_296h  2/20/2020  at 7:00 PM      25  2019-20           p
4    1  10  7  38  0.079        Acadia  20200220_296h  2/20/2020  at 7:00 PM      18  2019-20           p

volleyball_get_player_box_score

Fetches the player box score data for volleyball players over specified seasons.

Parameters:

  • gender (str): Specifies the gender of the teams. Must be either "m" or "w".
  • 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 player box scores. The columns of the returned DataFrame are: player_number, player, sp, k, e, ta, k_percentage, a, sa, se, re, digs, bs, ba, be, bhe, pts, team_name, player_links, game_id, date_time, start, season, and season_type.

Example:

from usportspy import volleyball_get_player_box_score

# Get player box scores for male teams for the 2019 and 2021 seasons
male_player_box_score = volleyball_get_player_box_score("m", [2019, 2021])
print(male_player_box_score.head())

# Get player box scores for female teams for the 2019 and 2021 seasons
female_player_box_score = volleyball_get_player_box_score("w", [2019, 2021])
print(female_player_box_score.head())

Expected output:

  player_number           player sp  k  e  ...        game_id             date_time  start   season  season_type
0             4      Tomas Sorra  3  2  0  ...  20200220_io53  2/20/2020 at 7:00 PM   True  2019-20            p
1             7  Hamish Hazelden  3  4  7  ...  20200220_io53  2/20/2020 at 7:00 PM   True  2019-20            p
2            12      Mac McNicol  3  6  3  ...  20200220_io53  2/20/2020 at 7:00 PM   True  2019-20            p
3            13  Mitchell Higgin  3  5  0  ...  20200220_io53  2/20/2020 at 7:00 PM   True  2019-20            p
4            14       Liam Kuppe  3  6  2  ...  20200220_io53  2/20/2020 at 7:00 PM   True  2019-20            p

[5 rows x 24 columns]


  player_number            player sp   k  e  ...        game_id             date_time  start   season  season_type
0             1    Peyton DeWolfe  4  11  6  ...  20200220_296h  2/20/2020 at 7:00 PM   True  2019-20            p
1             4       Hannah Helm  4   7  2  ...  20200220_296h  2/20/2020 at 7:00 PM   True  2019-20            p
2             7     Emilie Albert  3   0  0  ...  20200220_296h  2/20/2020 at 7:00 PM   True  2019-20            p
3             8  Taylor Collombin  4   3  5  ...  20200220_296h  2/20/2020 at 7:00 PM   True  2019-20            p
4             9     Jamie Crocket  4   1  1  ...  20200220_296h  2/20/2020 at 7:00 PM   True  2019-20            p

[5 rows x 24 columns]

volleyball_get_pbp

Fetches the play-by-play (PBP) data for volleyball games over specified seasons.

Parameters:

  • gender (str): Specifies the gender of the teams. Must be either "m" or "w".
  • 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 play-by-play data. The columns of the returned DataFrame are: event, home, away, score, set, game_id, season, and season_type.

Example:

from usportspy import volleyball_get_pbp

# Get PBP data for male teams for the 2019 and 2021 seasons
male_pbp = volleyball_get_pbp("m", [2019, 2021])
print(male_pbp.head())

# Get PBP data for female teams for the 2019 and 2021 seasons
female_pbp = volleyball_get_pbp("w", [2019, 2021])
print(female_pbp.head())

Expected output:

                                               event  home away score  set        game_id   season season_type
0  BRNM starters: Mason Metcalf; Reece Dixon; Cha...  BRNM  CGY   NaN    1  20200220_io53  2019-20           p
1  CGY starters: Tomas Sorra; Hamish Hazelden; Li...  BRNM  CGY   NaN    1  20200220_io53  2019-20           p
2                          CGY subs: Bradley Noskey.  BRNM  CGY   NaN    1  20200220_io53  2019-20           p
3          [Robin Baghdady] Service error. Point CGY  BRNM  CGY   1-0    1  20200220_io53  2019-20           p
4  [Mitchell Higgin] Service ace (Max Brook). Poi...  BRNM  CGY   2-0    1  20200220_io53  2019-20           p


                                               event      home    away score  set        game_id   season season_type
0  SAINT MA starters: Megan Bruhm; Emilla Conlon;...  SAINT MA  ACADIA   NaN    1  20200220_296h  2019-20           p
1  ACADIA starters: Peyton DeWolfe; Hannah Helm; ...  SAINT MA  ACADIA   NaN    1  20200220_296h  2019-20           p
2  [Peyton DeWolfe] Attack error by Taylor Collom...  SAINT MA  ACADIA   0-1    1  20200220_296h  2019-20           p
3        [Bethany Smith] Service error. Point ACADIA  SAINT MA  ACADIA   1-1    1  20200220_296h  2019-20           p
4     [Hannah Helm] Service ace (Team). Point ACADIA  SAINT MA  ACADIA   2-1    1  20200220_296h  2019-20           p