rugbypy
================
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
`rugbypy` is a Python package that aims to make rugby data more
available to aid in the development of rugby analytics. Currently we
only have 2023 data available with previous years coming soon!
![PyPI - Downloads](https://img.shields.io/pypi/dm/rugbypy)
## Requirements
python version 3.8
## Install
``` sh
pip install rugbypy
```
## How to use
### Match Stats
You can fetch all the matches that occured on a particular date with:
``` python
matches = fetch_matches(date="20230101")
matches
```
Fetching matches on date:20230101...
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>match_id</th>
<th>competition_id</th>
<th>home_team_id</th>
<th>away_team_id</th>
<th>date</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>595735</td>
<td>267979</td>
<td>25907</td>
<td>25901</td>
<td>20230101</td>
</tr>
</tbody>
</table>
</div>
Then using that match id you can feed it into the match details
function:
``` python
match_details = fetch_match_details(match_id="595735")
match_details
```
Fetching match details for match_id:595735...
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>match_id</th>
<th>date</th>
<th>competition_id</th>
<th>competition</th>
<th>venue_id</th>
<th>venue</th>
<th>city_played</th>
<th>home_team</th>
<th>away_team</th>
<th>home_team_id</th>
<th>away_team_id</th>
<th>completed</th>
<th>is_tournament</th>
<th>played_on_grass</th>
<th>attendance</th>
<th>home_team_form</th>
<th>away_team_form</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>595735</td>
<td>20230101</td>
<td>267979</td>
<td>Premiership Rugby</td>
<td>26070</td>
<td>cinch Stadium at Franklin's Gardens</td>
<td>Northampton</td>
<td>Northampton Saints</td>
<td>Harlequins</td>
<td>25907</td>
<td>25901</td>
<td>True</td>
<td>True</td>
<td>True</td>
<td>None</td>
<td>LLWWL</td>
<td>WLWLL</td>
</tr>
</tbody>
</table>
</div>
### Team Stats
You can then fetch the team stats for a particular team on a particular
date with:
``` python
team_stats = fetch_team_stats(team_id="25901", date="20230108")
team_stats
```
Fetching team stats for team_id:25901 on date:20230108...
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>team</th>
<th>game_date</th>
<th>team_id</th>
<th>team_vs</th>
<th>team_vs_id</th>
<th>clean_breaks</th>
<th>conversion_goals</th>
<th>defenders_beaten</th>
<th>kick_percent_success</th>
<th>kicks</th>
<th>...</th>
<th>scrums_total</th>
<th>scrums_won</th>
<th>tackles</th>
<th>territory</th>
<th>total_free_kicks_conceded</th>
<th>total_lineouts</th>
<th>tries</th>
<th>turnover_knock_on</th>
<th>turnovers_conceded</th>
<th>yellow_cards</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>Harlequins</td>
<td>20230108</td>
<td>25901</td>
<td>Sale Sharks</td>
<td>25908</td>
<td>3.0</td>
<td>0.0</td>
<td>24.0</td>
<td>0.5</td>
<td>0.0</td>
<td>...</td>
<td>7.0</td>
<td>5.0</td>
<td>125.0</td>
<td>0.41</td>
<td>0.0</td>
<td>11.0</td>
<td>2.0</td>
<td>8.0</td>
<td>17.0</td>
<td>0.0</td>
</tr>
</tbody>
</table>
<p>1 rows × 40 columns</p>
</div>
### Player Stats
We have the ability to fetch player stats for all the games they have
bene involved in. We firstly identify the \`player_id\`\` of a player by
searching our player manifest file.
``` python
player_manifest = fetch_all_players()
player_manifest.head()
```
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>player_id</th>
<th>player_name</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>246815</td>
<td>Will Edwards</td>
</tr>
<tr>
<th>1</th>
<td>158708</td>
<td>Tommaso Allan</td>
</tr>
<tr>
<th>2</th>
<td>299436</td>
<td>Oscar Beard</td>
</tr>
<tr>
<th>3</th>
<td>299031</td>
<td>Fin Baxter</td>
</tr>
<tr>
<th>4</th>
<td>298485</td>
<td>Jordan Els</td>
</tr>
</tbody>
</table>
</div>
Or we can search for a certain player through our similarity tool:
``` python
individual_player = fetch_player(name="johnny sexton")
individual_player
```
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>player_id</th>
<th>player_name</th>
</tr>
</thead>
<tbody>
<tr>
<th>267</th>
<td>149315</td>
<td>Anthony Watson</td>
</tr>
<tr>
<th>294</th>
<td>16004</td>
<td>Johnny Sexton</td>
</tr>
<tr>
<th>796</th>
<td>291349</td>
<td>Ayden Johnstone</td>
</tr>
</tbody>
</table>
</div>
We can also fetch the player stats for any player using their
`player_ids`. In this example we fetch Johnny Sextons player stats:
``` python
player_stats = fetch_player_stats(player_id="16004")
player_stats
```
Fetching all player stats for player_id:16004...
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>player_id</th>
<th>game_date</th>
<th>name</th>
<th>team</th>
<th>team_id</th>
<th>competition_id</th>
<th>competition</th>
<th>team_vs</th>
<th>team_vs_id</th>
<th>weight</th>
<th>...</th>
<th>rucks_won</th>
<th>runs</th>
<th>tackles</th>
<th>total_free_kicks_conceded</th>
<th>total_lineouts</th>
<th>tries</th>
<th>try_assists</th>
<th>turnover_knock_on</th>
<th>turnovers_conceded</th>
<th>yellow_cards</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>16004</td>
<td>20230204</td>
<td>Johnny Sexton</td>
<td>Ireland</td>
<td>3</td>
<td>180659</td>
<td>Six Nations Championship</td>
<td>4</td>
<td>Wales</td>
<td>92.0</td>
<td>...</td>
<td>3.0</td>
<td>8.0</td>
<td>7.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>1.0</td>
<td>0.0</td>
</tr>
<tr>
<th>0</th>
<td>16004</td>
<td>20230211</td>
<td>Johnny Sexton</td>
<td>Ireland</td>
<td>3</td>
<td>180659</td>
<td>Six Nations Championship</td>
<td>9</td>
<td>France</td>
<td>92.0</td>
<td>...</td>
<td>1.0</td>
<td>5.0</td>
<td>3.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
</tr>
<tr>
<th>0</th>
<td>16004</td>
<td>20230312</td>
<td>Johnny Sexton</td>
<td>Ireland</td>
<td>3</td>
<td>180659</td>
<td>Six Nations Championship</td>
<td>2</td>
<td>Scotland</td>
<td>92.0</td>
<td>...</td>
<td>2.0</td>
<td>5.0</td>
<td>9.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>2.0</td>
<td>0.0</td>
</tr>
<tr>
<th>0</th>
<td>16004</td>
<td>20230318</td>
<td>Johnny Sexton</td>
<td>Ireland</td>
<td>3</td>
<td>180659</td>
<td>Six Nations Championship</td>
<td>1</td>
<td>England</td>
<td>92.0</td>
<td>...</td>
<td>6.0</td>
<td>9.0</td>
<td>5.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>1.0</td>
<td>2.0</td>
<td>0.0</td>
</tr>
<tr>
<th>0</th>
<td>16004</td>
<td>20230909</td>
<td>Johnny Sexton</td>
<td>Ireland</td>
<td>3</td>
<td>164205</td>
<td>Rugby World Cup</td>
<td>12</td>
<td>Romania</td>
<td>92.0</td>
<td>...</td>
<td>0.0</td>
<td>5.0</td>
<td>4.0</td>
<td>0.0</td>
<td>0.0</td>
<td>2.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
</tr>
<tr>
<th>0</th>
<td>16004</td>
<td>20230916</td>
<td>Johnny Sexton</td>
<td>Ireland</td>
<td>3</td>
<td>164205</td>
<td>Rugby World Cup</td>
<td>16</td>
<td>Tonga</td>
<td>92.0</td>
<td>...</td>
<td>1.0</td>
<td>1.0</td>
<td>2.0</td>
<td>0.0</td>
<td>0.0</td>
<td>1.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
</tr>
</tbody>
</table>
<p>6 rows × 40 columns</p>
</div>
Raw data
{
"_id": null,
"home_page": "https://github.com/seanyboi/rugbypy",
"name": "rugbypy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "nbdev jupyter notebook python",
"author": "seanyboi",
"author_email": "oconnorjamessean@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cc/8d/073d326615b87f1434115252f9cffe81c4c54bb154f3ef7befafdb7ac1a0/rugbypy-1.0.0.tar.gz",
"platform": null,
"description": "rugbypy\n================\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n`rugbypy` is a Python package that aims to make rugby data more\navailable to aid in the development of rugby analytics. Currently we\nonly have 2023 data available with previous years coming soon!\n\n![PyPI - Downloads](https://img.shields.io/pypi/dm/rugbypy)\n\n## Requirements\n\npython version 3.8\n\n## Install\n\n``` sh\npip install rugbypy\n```\n\n## How to use\n\n### Match Stats\n\nYou can fetch all the matches that occured on a particular date with:\n\n``` python\nmatches = fetch_matches(date=\"20230101\")\nmatches\n```\n\n Fetching matches on date:20230101...\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>match_id</th>\n <th>competition_id</th>\n <th>home_team_id</th>\n <th>away_team_id</th>\n <th>date</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>595735</td>\n <td>267979</td>\n <td>25907</td>\n <td>25901</td>\n <td>20230101</td>\n </tr>\n </tbody>\n</table>\n</div>\n\nThen using that match id you can feed it into the match details\nfunction:\n\n``` python\nmatch_details = fetch_match_details(match_id=\"595735\")\nmatch_details\n```\n\n Fetching match details for match_id:595735...\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>match_id</th>\n <th>date</th>\n <th>competition_id</th>\n <th>competition</th>\n <th>venue_id</th>\n <th>venue</th>\n <th>city_played</th>\n <th>home_team</th>\n <th>away_team</th>\n <th>home_team_id</th>\n <th>away_team_id</th>\n <th>completed</th>\n <th>is_tournament</th>\n <th>played_on_grass</th>\n <th>attendance</th>\n <th>home_team_form</th>\n <th>away_team_form</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>595735</td>\n <td>20230101</td>\n <td>267979</td>\n <td>Premiership Rugby</td>\n <td>26070</td>\n <td>cinch Stadium at Franklin's Gardens</td>\n <td>Northampton</td>\n <td>Northampton Saints</td>\n <td>Harlequins</td>\n <td>25907</td>\n <td>25901</td>\n <td>True</td>\n <td>True</td>\n <td>True</td>\n <td>None</td>\n <td>LLWWL</td>\n <td>WLWLL</td>\n </tr>\n </tbody>\n</table>\n</div>\n\n### Team Stats\n\nYou can then fetch the team stats for a particular team on a particular\ndate with:\n\n``` python\nteam_stats = fetch_team_stats(team_id=\"25901\", date=\"20230108\")\nteam_stats\n```\n\n Fetching team stats for team_id:25901 on date:20230108...\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>team</th>\n <th>game_date</th>\n <th>team_id</th>\n <th>team_vs</th>\n <th>team_vs_id</th>\n <th>clean_breaks</th>\n <th>conversion_goals</th>\n <th>defenders_beaten</th>\n <th>kick_percent_success</th>\n <th>kicks</th>\n <th>...</th>\n <th>scrums_total</th>\n <th>scrums_won</th>\n <th>tackles</th>\n <th>territory</th>\n <th>total_free_kicks_conceded</th>\n <th>total_lineouts</th>\n <th>tries</th>\n <th>turnover_knock_on</th>\n <th>turnovers_conceded</th>\n <th>yellow_cards</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Harlequins</td>\n <td>20230108</td>\n <td>25901</td>\n <td>Sale Sharks</td>\n <td>25908</td>\n <td>3.0</td>\n <td>0.0</td>\n <td>24.0</td>\n <td>0.5</td>\n <td>0.0</td>\n <td>...</td>\n <td>7.0</td>\n <td>5.0</td>\n <td>125.0</td>\n <td>0.41</td>\n <td>0.0</td>\n <td>11.0</td>\n <td>2.0</td>\n <td>8.0</td>\n <td>17.0</td>\n <td>0.0</td>\n </tr>\n </tbody>\n</table>\n<p>1 rows \u00d7 40 columns</p>\n</div>\n\n### Player Stats\n\nWe have the ability to fetch player stats for all the games they have\nbene involved in. We firstly identify the \\`player_id\\`\\` of a player by\nsearching our player manifest file.\n\n``` python\nplayer_manifest = fetch_all_players()\nplayer_manifest.head()\n```\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>player_id</th>\n <th>player_name</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>246815</td>\n <td>Will Edwards</td>\n </tr>\n <tr>\n <th>1</th>\n <td>158708</td>\n <td>Tommaso Allan</td>\n </tr>\n <tr>\n <th>2</th>\n <td>299436</td>\n <td>Oscar Beard</td>\n </tr>\n <tr>\n <th>3</th>\n <td>299031</td>\n <td>Fin Baxter</td>\n </tr>\n <tr>\n <th>4</th>\n <td>298485</td>\n <td>Jordan Els</td>\n </tr>\n </tbody>\n</table>\n</div>\n\nOr we can search for a certain player through our similarity tool:\n\n``` python\nindividual_player = fetch_player(name=\"johnny sexton\")\nindividual_player\n```\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>player_id</th>\n <th>player_name</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>267</th>\n <td>149315</td>\n <td>Anthony Watson</td>\n </tr>\n <tr>\n <th>294</th>\n <td>16004</td>\n <td>Johnny Sexton</td>\n </tr>\n <tr>\n <th>796</th>\n <td>291349</td>\n <td>Ayden Johnstone</td>\n </tr>\n </tbody>\n</table>\n</div>\n\nWe can also fetch the player stats for any player using their\n`player_ids`. In this example we fetch Johnny Sextons player stats:\n\n``` python\nplayer_stats = fetch_player_stats(player_id=\"16004\")\nplayer_stats\n```\n\n Fetching all player stats for player_id:16004...\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>player_id</th>\n <th>game_date</th>\n <th>name</th>\n <th>team</th>\n <th>team_id</th>\n <th>competition_id</th>\n <th>competition</th>\n <th>team_vs</th>\n <th>team_vs_id</th>\n <th>weight</th>\n <th>...</th>\n <th>rucks_won</th>\n <th>runs</th>\n <th>tackles</th>\n <th>total_free_kicks_conceded</th>\n <th>total_lineouts</th>\n <th>tries</th>\n <th>try_assists</th>\n <th>turnover_knock_on</th>\n <th>turnovers_conceded</th>\n <th>yellow_cards</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>16004</td>\n <td>20230204</td>\n <td>Johnny Sexton</td>\n <td>Ireland</td>\n <td>3</td>\n <td>180659</td>\n <td>Six Nations Championship</td>\n <td>4</td>\n <td>Wales</td>\n <td>92.0</td>\n <td>...</td>\n <td>3.0</td>\n <td>8.0</td>\n <td>7.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>1.0</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>0</th>\n <td>16004</td>\n <td>20230211</td>\n <td>Johnny Sexton</td>\n <td>Ireland</td>\n <td>3</td>\n <td>180659</td>\n <td>Six Nations Championship</td>\n <td>9</td>\n <td>France</td>\n <td>92.0</td>\n <td>...</td>\n <td>1.0</td>\n <td>5.0</td>\n <td>3.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>0</th>\n <td>16004</td>\n <td>20230312</td>\n <td>Johnny Sexton</td>\n <td>Ireland</td>\n <td>3</td>\n <td>180659</td>\n <td>Six Nations Championship</td>\n <td>2</td>\n <td>Scotland</td>\n <td>92.0</td>\n <td>...</td>\n <td>2.0</td>\n <td>5.0</td>\n <td>9.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>2.0</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>0</th>\n <td>16004</td>\n <td>20230318</td>\n <td>Johnny Sexton</td>\n <td>Ireland</td>\n <td>3</td>\n <td>180659</td>\n <td>Six Nations Championship</td>\n <td>1</td>\n <td>England</td>\n <td>92.0</td>\n <td>...</td>\n <td>6.0</td>\n <td>9.0</td>\n <td>5.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>1.0</td>\n <td>2.0</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>0</th>\n <td>16004</td>\n <td>20230909</td>\n <td>Johnny Sexton</td>\n <td>Ireland</td>\n <td>3</td>\n <td>164205</td>\n <td>Rugby World Cup</td>\n <td>12</td>\n <td>Romania</td>\n <td>92.0</td>\n <td>...</td>\n <td>0.0</td>\n <td>5.0</td>\n <td>4.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>2.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>0</th>\n <td>16004</td>\n <td>20230916</td>\n <td>Johnny Sexton</td>\n <td>Ireland</td>\n <td>3</td>\n <td>164205</td>\n <td>Rugby World Cup</td>\n <td>16</td>\n <td>Tonga</td>\n <td>92.0</td>\n <td>...</td>\n <td>1.0</td>\n <td>1.0</td>\n <td>2.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>1.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>0.0</td>\n </tr>\n </tbody>\n</table>\n<p>6 rows \u00d7 40 columns</p>\n</div>\n\n\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Repository for rugby data analytics",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/seanyboi/rugbypy"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "346af1327ffb9c8ce00d92dd9bc20a4babf532e46e7edf6a9fea6381c9b6e3ca",
"md5": "efb13313e4d088bd6c13b18242dc6559",
"sha256": "0c80a7b06e2f40cfade83e87319f0d8999c9a74b09fcaf147ca185326808839f"
},
"downloads": -1,
"filename": "rugbypy-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "efb13313e4d088bd6c13b18242dc6559",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11678,
"upload_time": "2023-09-22T13:22:37",
"upload_time_iso_8601": "2023-09-22T13:22:37.047585Z",
"url": "https://files.pythonhosted.org/packages/34/6a/f1327ffb9c8ce00d92dd9bc20a4babf532e46e7edf6a9fea6381c9b6e3ca/rugbypy-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cc8d073d326615b87f1434115252f9cffe81c4c54bb154f3ef7befafdb7ac1a0",
"md5": "dfc1076f74a9502114cd575821a2cb6a",
"sha256": "c0ef73ede02c75c374194b8793d06ee2b7a402de6c77ac204d58f936cfc702b9"
},
"downloads": -1,
"filename": "rugbypy-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "dfc1076f74a9502114cd575821a2cb6a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 14268,
"upload_time": "2023-09-22T13:22:38",
"upload_time_iso_8601": "2023-09-22T13:22:38.758261Z",
"url": "https://files.pythonhosted.org/packages/cc/8d/073d326615b87f1434115252f9cffe81c4c54bb154f3ef7befafdb7ac1a0/rugbypy-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-22 13:22:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "seanyboi",
"github_project": "rugbypy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "rugbypy"
}