Repository for rugby data analytics
Project description
rugbypy
rugbypy
is a Python package that aims to make rugby data more
available to aid in the development of rugby analytics.
Requirements
python version 3.8
Install
pip install rugbypy
conda install -c seanyboi rugbypy
How to use
Match Stats
You can fetch all the matches that occured on a particular date with:
matches = fetch_matches(date="20230101")
matches
Fetching matches on date:20230101...
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
match_id | competition_id | home_team_id | away_team_id | date | |
---|---|---|---|---|---|
0 | 595735 | 267979 | 25907 | 25901 | 20230101 |
Then using that match id you can feed it into the match details function:
match_details = fetch_match_details(match_id="595735")
match_details
Fetching match details for match_id:595735...
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
match_id | date | competition_id | competition | venue_id | venue | city_played | home_team | away_team | home_team_id | away_team_id | completed | is_tournament | played_on_grass | attendance | home_team_form | away_team_form | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 595735 | 20230101 | 267979 | Premiership Rugby | 26070 | cinch Stadium at Franklin's Gardens | Northampton | Northampton Saints | Harlequins | 25907 | 25901 | True | True | True | None | LLWWL | WLWLL |
Team Stats
You can then fetch the team stats for a particular team on a particular dates with:
team_stats = fetch_team_stats(team_id="25901", date="20230108")
team_stats
Fetching team stats for team_id:25901 on date:20230108...
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
team | game_date | team_id | team_vs | team_vs_id | clean_breaks | conversion_goals | defenders_beaten | kick_percent_success | kicks | ... | scrums_total | scrums_won | tackles | territory | total_free_kicks_conceded | total_lineouts | tries | turnover_knock_on | turnovers_conceded | yellow_cards | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Harlequins | 20230108 | 25901 | Sale Sharks | 25908 | 3.0 | 0.0 | 24.0 | 0.5 | 0.0 | ... | 7.0 | 5.0 | 125.0 | 0.41 | 0.0 | 11.0 | 2.0 | 8.0 | 17.0 | 0.0 |
1 rows × 40 columns
Player Stats
We can also fetch the player stats for any player using their player_ids. In this example we fetch Billy Twelvetrees in game stats:
player_stats = fetch_player_stats(player_id="102049")
player_stats
Fetching all player stats for player_id:102049...
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
player_id | game_date | name | team | team_id | competition_id | competition | team_vs | team_vs_id | weight | ... | rucks_won | runs | tackles | total_free_kicks_conceded | total_lineouts | tries | try_assists | turnover_knock_on | turnovers_conceded | yellow_cards | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 102049 | 20230106 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25909 | Saracens | 101.0 | ... | 0.0 | 0.0 | 2.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1.0 | 1.0 | 0.0 |
0 | 102049 | 20230128 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 116227 | Exeter Chiefs | 101.0 | ... | 3.0 | 2.0 | 15.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1.0 | 0.0 |
0 | 102049 | 20230225 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25907 | Northampton Saints | 101.0 | ... | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1.0 | 1.0 | 0.0 |
0 | 102049 | 20230312 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25903 | Leicester Tigers | 101.0 | ... | 0.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
0 | 102049 | 20230324 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25906 | Newcastle Falcons | 101.0 | ... | 0.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
0 | 102049 | 20230414 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25898 | Bath Rugby | 101.0 | ... | 1.0 | 2.0 | 9.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1.0 | 2.0 | 0.0 |
0 | 102049 | 20230422 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25908 | Sale Sharks | 101.0 | ... | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1.0 | 1.0 | 0.0 |
0 | 102049 | 20230506 | Billy Twelvetrees | Gloucester Rugby | 25900 | 267979 | Premiership Rugby | 25899 | Bristol Rugby | 101.0 | ... | 0.0 | 1.0 | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 2.0 | 1.0 | 0.0 |
8 rows × 40 columns
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rugbypy-0.0.2.tar.gz
.
File metadata
- Download URL: rugbypy-0.0.2.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1f37a02005bf684dafe2b9942b9b3701025702f10b312fd23a22d11abdc98b5 |
|
MD5 | 4ca829b74cfc3415989cbad8d261364f |
|
BLAKE2b-256 | 5188b12336659eebab9f130345dec302aa947f9433a47a9f9ed5bd203a697bf6 |
File details
Details for the file rugbypy-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: rugbypy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 614436d9c78f75526c917beb9e1860b018df0cfd01e78eee7cbd7ff1d8014872 |
|
MD5 | c708ff84b4c4293e04badad2418391c1 |
|
BLAKE2b-256 | 96fcf09b6c1a5fed5f474e2f81bf0b9eef355ae29697fc046fc55cff26753b9e |