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.

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

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:

   league   season        game_id        date  exhibition  ...   home_team  away_team  home_score away_score                                          game_link
0  mvball  2009-10            NaN  2009-10-02        True  ...      queens       york           3          1                                                NaN
1  mvball  2009-10            NaN  2009-10-03        True  ...  sherbrooke       york           2          3                                                NaN
2  mvball  2009-10            NaN  2009-10-16        True  ...        york     seneca           4          0                                                NaN
3  mvball  2009-10            NaN  2009-10-17        True  ...        york     humber           4          0                                                NaN
4  mvball  2009-10  20091023_ju03  2009-10-23       False  ...     alberta    calgary           3          1  https://en.usports.ca/sports/mvball/2009-10/bo...

[5 rows x 13 columns]
   league   season        game_id        date  exhibition  ...  home_team  away_team  home_score away_score                                          game_link
0  wvball  2009-10            NaN  2009-10-09        True  ...     guelph       york           3          1                                                NaN
1  wvball  2009-10            NaN  2009-10-11        True  ...    ryerson       york           1          3                                                NaN
2  wvball  2009-10  20091016_2ibt  2009-10-16       False  ...    western    laurier           3          0  https://en.usports.ca/sports/wvball/2009-10/bo...
3  wvball  2009-10  20091023_yolp  2009-10-23       False  ...    alberta    calgary           3          1  https://en.usports.ca/sports/wvball/2009-10/bo...
4  wvball  2009-10  20091023_8fmb  2009-10-23       False  ...     regina   manitoba           0          3  https://en.usports.ca/sports/wvball/2009-10/bo...

[5 rows x 13 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, kills, errors, total_attacks, attack_efficiency, team, date, sport, link, game_id, season, path.

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  kills  errors  total_attacks  attack_efficiency          team        date   sport                                               link        game_id   season path
0  1.0   13.0     3.0           24.0              0.417  UBC Okanagan  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
1  2.0   14.0     5.0           29.0              0.310  UBC Okanagan  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
2  3.0    9.0     8.0           29.0              0.034  UBC Okanagan  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
3  4.0   13.0     7.0           29.0              0.207  UBC Okanagan  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
4  1.0    9.0     7.0           25.0              0.080       Calgary  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
   set  kills  errors  total_attacks  attack_efficiency  set_clean  ...        date   sport                                               link        game_id   season path
0    1     15       5             32              0.312        1.0  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
1    2     10       6             27              0.148        2.0  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
2    3     14       4             35              0.286        3.0  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
3    1      5       4             29              0.034        1.0  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
4    2      5      12             28             -0.250        2.0  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN

[5 rows x 13 columns]

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: jersey, player, sets_played, kills, errors, total_attacks, attack_efficiency, assists, service_aces, service_errors, receive_errors, digs, block_stuffs, block_assists, block_errors, ball_handling_errors, points, team, starter_status, player_links, team_status, date, sport, link, game_id, season, path.

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:

  jersey          player  sets_played  kills  errors  total_attacks  ...        date   sport                                               link        game_id   season  path
0      3     Max Heppell          3.0    2.0     1.0            5.0  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20   NaN
1      4   Noah Campbell          4.0   13.0     4.0           25.0  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20   NaN
2      6  Cam Vanderveen          4.0    9.0     8.0           28.0  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20   NaN
3      7  Jakob Hamilton          3.0    0.0     0.0            0.0  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20   NaN
4      8  Morgan Nichols          4.0    0.0     1.0            2.0  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20   NaN

[5 rows x 27 columns]
  jersey             player  sets_played  kills  errors  total_attacks  ...        date   sport                                               link        game_id   season  path
0      1         Caitlin Le            3      0       0              0  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20   NaN
1      3      Alexa Shoults            3      0       0              1  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20   NaN
2      4        Rayvn Weibe            3      8       3             23  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20   NaN
3      5  Danielle Larocque            3      5       0             12  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20   NaN
4      6    Shayne Nicholes            2      0       1              1  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20   NaN

[5 rows x 27 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: set, away_score, home_score, server, player, event, assist, point_by_error, block_player_one, block_player_two, block_player_three, team_point, desc, date, sport, link, game_id, season, path.

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:

   set  away_score  home_score          server      player         event  ...        date   sport                                               link        game_id   season path
0    1         NaN         NaN             NaN         NaN           NaN  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
1    1         NaN         NaN             NaN         NaN           NaN  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
2    1         NaN         NaN             NaN         NaN           NaN  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
3    1         1.0         0.0  Jakob Hamilton  Liam Kuppe           NaN  ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN
4    1         2.0         0.0  Jakob Hamilton         NaN  Service ace   ...  2019-09-26  mvball  https://en.usports.ca/sports/mvball/2019-20/bo...  20190926_137x  2019-20  NaN

[5 rows x 19 columns]
   set  away_score  home_score           server               player event  ...        date   sport                                               link        game_id   season path
0    1         NaN         NaN              NaN                  NaN   NaN  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
1    1         NaN         NaN              NaN                  NaN   NaN  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
2    1         1.0         0.0  Margaret Henley   Danielle Larocque   Kill  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
3    1         2.0         0.0      Rayvn Weibe      Nicole Ashauer   Kill  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN
4    1         2.0         1.0      Rayvn Weibe  Cecilie Dumaresque   Kill  ...  2019-09-20  wvball  https://en.usports.ca/sports/wvball/2019-20/bo...  20190920_73jc  2019-20  NaN

[5 rows x 19 columns]