Cross Country - uwaggs/usportspy GitHub Wiki
Cross-Country Module
The usportspy
package provides functions to retrieve various data related to Cross-Country, such as 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.
Functions
xc_team_rankings
Fetches the rankings of cross-country teams based on gender, seasons, and universities.
Parameters:
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.
Returns:
pd.DataFrame
: A DataFrame containing the filtered cross-country team rankings. The columns of the returned DataFrame are: season, gender, date, week, ranking, university, and pts.
Example:
from usportspy import xc_team_rankings
# Get the team rankings for male teams in the 2023 season
team_rankings = xc_team_rankings("m", seasons=[2023])
print(team_rankings.head())
Expected output:
season gender date week ranking university pts
0 2023 MEN 10/30/2023 7 1 Laval 96
1 2023 MEN 10/30/2023 7 2 UBC 86
2 2023 MEN 10/30/2023 7 3 Guelph 80
3 2023 MEN 10/30/2023 7 4 Queen’s 73
4 2023 MEN 10/30/2023 7 5 UNB 54
xc_rosters
Fetches the rosters of cross-country teams based on gender, seasons, and universities.
Parameters:
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.
Returns:
pd.DataFrame
: A DataFrame containing the filtered cross-country team rosters. The columns of the returned DataFrame are: university, name, sex, birthday, program_position, eligibility, hometown, type, and recorded_date.
Example:
from usportspy import xc_rosters
# Get the rosters for female teams in the 2024 season
rosters = xc_rosters("w", seasons=[2024])
print(rosters.head())
Expected output:
university name sex birthday program_position eligibility hometown type recorded_date
14 Brock University Robyn Adamo F 1999 Teacher Education - Intermediate Senior NaN Mississauga, ON Athlete 08/15/2024-17:59:42
15 Brock University Anna Ciepielewski F 2004 Kinesiology NaN Brantford, ON Athlete 08/15/2024-17:59:42
16 Brock University Elizabeth Gay F 2000 NaN NaN NaN Athlete 08/15/2024-17:59:42
17 Brock University Cori Macsai F 2002 NaN NaN Port Colborne, ON Athlete 08/15/2024-17:59:42
18 Brock University Lauren Macsai F 2002 Game Design NaN Port Colborne, ON Athlete 08/15/2024-17:59:42
xc_meet_results
Fetches the meet results of cross-country events based on seasons and universities.
Parameters:
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.
Returns:
pd.DataFrame
: A DataFrame containing the filtered cross-country meet results. The columns of the returned DataFrame are: date, name, location, and results.
Example:
from usportspy import xc_meet_results
# Get the meet results for the 2022 season
meet_results = xc_meet_results([2022])
print(meet_results.head())
Expected output:
date name location results
493 11/12/2022 USports Cross Country Champs Halifax, NS /results/usports-cross-country-champs/9082/
494 10/29/2022 RSEQ Kinadapt - Rawdon, QC /results/rseq/9077/
495 10/29/2022 Canada West XC Champs Abbotsford, BC /results/canada-west-xc-champs/9078/
496 10/29/2022 OUA Cross Country Champs London, ON /results/oua-cross-country-champs/9079/
497 10/29/2022 AUS X-Country Champs Stratford, PE /results/aus-x-country-champs/9080/
xc_universities
Fetches the list of universities that have cross-country teams.
Parameters:
- None
Returns:
pd.DataFrame
: A DataFrame containing the list of universities with cross-country teams. The columns of the returned DataFrame are: university, conference, link, team_version, and athlete_version.
Example:
from usportspy import xc_universities
# Get the list of universities
universities = xc_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