Track and Field - uwaggs/usportspy GitHub Wiki
The usportspy
package includes functions to retrieve various data related to Track and Field, such as athlete rankings, team rankings, rosters, meet results, and universities. Note for fields that return a part of a URL that the prefix should be https://www.trackie.com
as that is where the reference is to.
Fetches the rankings of track and field athletes based on gender, seasons, athlete names, events, and universities.
-
gender
(str): 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. -
athlete_names
(list of str, optional): List of athlete names to filter by. -
events
(list of str, optional): List of events to filter by. -
universities
(list of str, optional): List of universities to filter by. If nothing is provided, data for all universities will be returned.
-
pd.DataFrame
: A DataFrame containing the filtered track and field athlete rankings. The columns of the returned DataFrame are: rank, athlete_name, athlete_link, university, performance, yoe, meet, meet_link, placement, date, gender, season, event, and recorded_date.
from usportspy import tnf_athlete_rankings
# Get the rankings for male athletes in the 2019 season
rankings = tnf_athlete_rankings("m", seasons=[2019])
print(rankings.head())
Expected output:
rank athlete_name athlete_link university performance ... date gender season event recorded_date
1775 1 Andre Azonwanna /usports/tnf/athletes/andre-azonwanna/10118/ GUEL 6.75 ... 03/05/2020 men 2019/2020 60-meter 09/01/2024-20:34:43
1776 1 Praise Olatoke /usports/tnf/athletes/praise-olatoke/9401/ TRIN 6.75 ... 03/05/2020 men 2019/2020 60-meter 09/01/2024-20:34:43
1777 3 Keysean Powell /usports/tnf/athletes/keysean-powell/10091/ YORK 6.77 ... 02/21/2020 men 2019/2020 60-meter 09/01/2024-20:34:43
1778 4 Tremaine Harris /usports/tnf/athletes/tremaine-harris/10122/ GUEL 6.78 ... 01/10/2020 men 2019/2020 60-meter 09/01/2024-20:34:43
1779 5 Karson Lehner /usports/tnf/athletes/karson-lehner/7366/ SASK 6.80 ... 03/05/2020 men 2019/2020 60-meter 09/01/2024-20:34:43
[5 rows x 14 columns]
Fetches the rankings of track and field teams based on gender, seasons, and universities.
-
gender
(str): 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. -
universities
(list of str, optional): List of universities to filter by. If nothing is provided, data for all universities will be returned.
-
pd.DataFrame
: A DataFrame containing the filtered track and field team rankings. The columns of the returned DataFrame are: season, gender, ranking, university, pts, and recorded_date.
from usportspy import tnf_team_rankings
# Get the team rankings for female teams in the 2023 season
team_rankings = tnf_team_rankings("w", seasons=[2023])
print(team_rankings.head())
Expected output:
season gender ranking university pts recorded_date
10 2023/2024 Women 1 Western 120.5 07/19/2024-23:15:02
11 2023/2024 Women 2 Guelph 118.5 07/19/2024-23:15:02
12 2023/2024 Women 3 Saskatchewan 96.0 07/19/2024-23:15:02
13 2023/2024 Women 4 Calgary 75.5 07/19/2024-23:15:02
14 2023/2024 Women 5 Laval 62.0 07/19/2024-23:15:02
Fetches the rosters of track and field teams based on gender, seasons, and universities.
-
gender
(str): 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. -
universities
(list of str, optional): List of universities to filter by. If nothing is provided, data for all universities will be returned.
-
pd.DataFrame
: A DataFrame containing the filtered track and field team rosters. The columns of the returned DataFrame are: university, name, sex, birthday, program_position, eligibility, hometown, type, and recorded_date.
from usportspy import tnf_rosters
# Get the rosters for male teams in the 2024 season
rosters = tnf_rosters("m", seasons=[2024])
print(rosters.head())
Expected output:
university name sex birthday program_position eligibility hometown type recorded_date
0 Brock University Spencer House M NaN Coach NaN Saskatoon Support 07/19/2024-22:33:56
1 Brock University Kevin Moore M NaN Assistant Coach NaN St. Catharines, ON Support 07/19/2024-22:33:56
2 Brock University Morris Agyeman M 2005 NaN 1.0 NaN Athlete 07/19/2024-22:33:56
3 Brock University Andrew Armstrong M 1982 PhD Behavioural & Cognitive Neuroscience NaN Thorold, ON Athlete 07/19/2024-22:33:56
4 Brock University Khalifa Badamasi M 1992 General Humanities NaN Abuja, Nigeria Athlete 07/19/2024-22:33:56
Fetches the meet results of track and field events based on seasons and universities.
-
seasons
(list of int, optional): List of seasons (starting year) to filter by. If nothing is provided, data for all seasons will be returned. -
universities
(list of str, optional): List of universities to filter by. If nothing is provided, data for all universities will be returned.
-
pd.DataFrame
: A DataFrame containing the filtered track and field meet results. The columns of the returned DataFrame are: date, name, location, and results.
from usportspy import tnf_meet_results
# Get the meet results for the 2022 season
meet_results = tnf_meet_results([2022])
print(meet_results.head())
Expected output:
date name location results
1005 12/17/2022 Santa Claus Throws Saskatoon, SK /results/santa-claus-throws/9137/
1006 12/17/2022 La Derniere Chance Moncton, NB /results/la-derniere-chance/9138/
1007 12/17/2022 Bolton Pole Vault Indoor Meet #1 Bolton, ON /results/bolton-pole-vault-indoor-meet-1/9140/
1008 12/10/2022 Larmer Friendship Games Regina, SK /results/larmer-friendship-games/9118/
1009 12/10/2022 CSS Opener Duluth, MN /results/css-opener/9136/
Fetches the list of universities that have track and field teams.
- None
-
pd.DataFrame
: A DataFrame containing the list of universities with track and field teams. The columns of the returned DataFrame are: university, conference, link, team_version, and athlete_version.
from usportspy import tnf_universities
# Get the list of universities
universities = tnf_universities()
print(universities.head())
Expected output:
university conference link team_version athlete_version
0 Brock University Ontario University Athletics https://www.trackie.com/usports/tnf/universiti... NaN BROC
1 Lakehead University Ontario University Athletics https://www.trackie.com/usports/tnf/universiti... NaN LAKE
2 Laurentian University Ontario University Athletics https://www.trackie.com/usports/tnf/universiti... NaN LAUR
3 McMaster University Ontario University Athletics https://www.trackie.com/usports/tnf/universiti... NaN MCMA
4 Nipissing University Ontario University Athletics https://www.trackie.com/usports/tnf/universiti... NaN NaN