SkillAgentSearch skills...

Statsbombpy

Easily stream StatsBomb data into Python

Install / Use

/learn @statsbomb/Statsbombpy
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

statsbombpy <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/statsbomb/logos/blob/main/HudlStatsbomb_Python_Dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.com/statsbomb/logos/blob/main/HudlStatsbomb_Python.svg"><img alt="StatsBombPython_Lock" src="https://github.com/statsbomb/logos/blob/main/HudlStatsbomb_Python.svg" align="right" height="40"></picture>

PyPI version

Brought to you by StatsBomb, this repository is a Python package that allows users to easily stream StatsBomb data into Python using your log in credentials for the API or free data from our GitHub page. API access is for paying customers only

Support: support@statsbomb.com

Installation Instructions

pip install statsbombpy

Running the tests

nose2 -v --pretty-assert

Configuration

Authentication

Environment Variables

Authentication can be done by setting environment variables named SB_USERNAME and SB_PASSWORD to your login credentials.

Manual Calls

Alternatively, if you don't want to use environment variables, all functions accept an argument creds to pass your login credentials in the format {"user": "", "passwd": ""}

Concurrency

You can specify how many of your computer's cores to use when running the sb.competition_events() and sb.competition_frames() functions by setting the environment variable SB_CORES to the number you want to use. Allowing statsbombpy to use more cores will speed up those functions.

If you don't have an environment variable set we will try to detect the number of cores in your system and use 2 less than that number. If we cannot detect the number of cores we set the number to 4.

Open Data

StatsBomb's open data can be accessed without the need of authentication.

StatsBomb are committed to sharing new data and research publicly to enhance understanding of the game of Football. We want to actively encourage new research and analysis at all levels. Therefore we have made certain leagues of StatsBomb Data freely available for public use for research projects and genuine interest in football analytics.

StatsBomb are hoping that by making data freely available, we will extend the wider football analytics community and attract new talent to the industry. We would like to collect some basic personal information about users of our data. By giving us your email address, it means we will let you know when we make more data, tutorials and research available. We will store the information in accordance with our Privacy Policy and the GDPR.

Terms & Conditions

Whilst we are keen to share data and facilitate research, we also urge you to be responsible with the data. Please register your details on https://www.statsbomb.com/resource-centre and read our User Agreement carefully. By using this repository, you are agreeing to the user agreement. If you publish, share or distribute any research, analysis or insights based on this data, please state the data source as StatsBomb and use our logo.

Usage

from statsbombpy import sb

Competitions

sb.competitions()
<table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>competition_id</th> <th>season_id</th> <th>country_name</th> <th>competition_name</th> <th>competition_gender</th> <th>season_name</th> <th>match_updated</th> <th>match_available</th> </tr> </thead> <tbody> <tr> <th>0</th> <td>9</td> <td>42</td> <td>Germany</td> <td>1. Bundesliga</td> <td>male</td> <td>2019/2020</td> <td>2019-12-29T07:47:45.981</td> <td>2019-12-29T07:47:45.981</td> </tr> <tr> <th>1</th> <td>9</td> <td>4</td> <td>Germany</td> <td>1. Bundesliga</td> <td>male</td> <td>2018/2019</td> <td>2019-12-16T23:09:16.168756</td> <td>2019-12-16T23:09:16.168756</td> </tr> <tr> <th>2</th> <td>9</td> <td>1</td> <td>Germany</td> <td>1. Bundesliga</td> <td>male</td> <td>2017/2018</td> <td>2019-12-16T23:09:16.168756</td> <td>2019-12-16T23:09:16.168756</td> </tr> <tr> <th>3</th> <td>78</td> <td>42</td> <td>Croatia</td> <td>1. HNL</td> <td>male</td> <td>2019/2020</td> <td>2020-01-02T10:35:49.065</td> <td>2020-01-02T10:35:49.065</td> </tr> <tr> <th>4</th> <td>10</td> <td>42</td> <td>Germany</td> <td>2. Bundesliga</td> <td>male</td> <td>2019/2020</td> <td>2019-12-27T00:36:37.498</td> <td>2019-12-27T00:36:37.498</td> </tr> </tbody> </table>

Matches

sb.matches(competition_id=9, season_id=42)
<table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>match_id</th> <th>match_date</th> <th>kick_off</th> <th>competition</th> <th>season</th> <th>home_team</th> <th>away_team</th> <th>home_score</th> <th>away_score</th> <th>match_status</th> <th>last_updated</th> <th>match_week</th> <th>competition_stage</th> <th>stadium</th> <th>referee</th> <th>home_managers</th> <th>away_managers</th> <th>data_version</th> <th>shot_fidelity_version</th> <th>xy_fidelity_version</th> </tr> </thead> <tbody> <tr> <th>0</th> <td>303299</td> <td>2019-12-15</td> <td>18:00:00.000</td> <td>Germany - 1. Bundesliga</td> <td>2019/2020</td> <td>Schalke 04</td> <td>Eintracht Frankfurt</td> <td>1</td> <td>0</td> <td>available</td> <td>2019-12-17T09:50:17.558</td> <td>15</td> <td>Regular Season</td> <td>VELTINS-Arena</td> <td>F. Zwayer</td> <td>David Wagner</td> <td>Adi Hütter</td> <td>1.1.0</td> <td>2</td> <td>2</td> </tr> <tr> <th>1</th> <td>303223</td> <td>2019-09-01</td> <td>18:00:00.000</td> <td>Germany - 1. Bundesliga</td> <td>2019/2020</td> <td>Eintracht Frankfurt</td> <td>Fortuna Düsseldorf</td> <td>2</td> <td>1</td> <td>available</td> <td>2019-12-16T23:09:16.168756</td> <td>3</td> <td>Regular Season</td> <td>Commerzbank-Arena</td> <td>F. Willenborg</td> <td>Adi Hütter</td> <td>Friedhelm Funkel</td> <td>1.1.0</td> <td>2</td> <td>2</td> </tr> <tr> <th>2</th> <td>303083</td> <td>2019-12-15</td> <td>15:30:00.000</td> <td>Germany - 1. Bundesliga</td> <td>2019/2020</td> <td>Wolfsburg</td> <td>Borussia Mönchengladbach</td> <td>2</td> <td>1</td> <td>available</td> <td>2019-12-17T15:52:17.843</td> <td>15</td> <td>Regular Season</td> <td>VOLKSWAGEN ARENA</td> <td>F. Brych</td> <td>Oliver Glasner</td> <td>Marco Rose</td> <td>1.1.0</td> <td>2</td> <td>2</td> </tr> <tr> <th>3</th> <td>303266</td> <td>2019-12-14</td> <td>15:30:00.000</td> <td>Germany - 1. Bundesliga</td> <td>2019/2020</td> <td>Hertha Berlin</td> <td>Freiburg</td> <td>1</td> <td>0</td> <td>available</td> <td>2019-12-17T17:43:18.285</td> <td>15</td> <td>Regular Season</td> <td>Olympiastadion Berlin</td> <td>F. Willenborg</td> <td>Jürgen Klinsmann</td> <td>Christian Streich</td> <td>1.1.0</td> <td>2</td> <td>2</td> </tr> <tr> <th>4</th> <td>303073</td> <td>2019-12-21</td> <td>15:30:00.000</td> <td>Germany - 1. Bundesliga</td> <td>2019/2020</td> <td>Bayern Munich</td> <td>Wolfsburg</td> <td>2</td> <td>0</td> <td>available</td> <td>2019-12-23T18:02:36.454</td> <td>17</td> <td>Regular Season</td> <td>Allianz Arena</td> <td>C. Dingert</td> <td>Hans-Dieter Flick</td> <td>Oliver Glasner </td> <td>1.1.0</td> <td>2</td> <td>2</td> </tr> </tbody> </table>

Lineups

sb.lineups(match_id=303299)["Eintracht Frankfurt"]
<table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>player_id</th> <th>player_name</th> <th>player_nickname</th> <th>birth_date</th> <th>player_gender</th> <th>player_height</th> <th>player_weight</th> <th>jersey_number</th> <th>country</th> </tr> </thead> <tbody> <tr> <th>0</th> <td>3204</td> <td>Almamy Touré</td> <td>None</td> <td>1996-04-28</td> <td>male</td> <td>182.0</td> <td>72.0</td> <td>18</td> <td>Mali</td> </tr> <tr> <th>1</th> <td>5591</td> <td>Filip Kostić</td> <td>None</td> <td>1992-11-01</td> <td>male</td> <td>184.0</td> <td>82.0</td> <td>10</td> <td>Serbia</td> </tr> <tr> <th>2</th> <td>7713</td> <td>Obite Evan N"Dicka</td> <td>Evan N'Dicka</td> <td>1999-08-20</td> <td>male</td> <td>190.0</td> <td>NaN</td> <td>2</td> <td>France</td> </tr> <tr> <th>3</th> <td>8307</td> <td>Martin Hinteregger</td> <td>None</td> <td>1992-09-07</td> <td>male</td> <td>184.0</td> <td>83.0</td> <td>13</td> <td>Austria</td> </tr> <tr> <th>4</th> <td>8669</td> <td>Mijat Gaćinović</td> <td>None</td> <td>1995-02-08</td>

Related Skills

View on GitHub
GitHub Stars703
CategoryDevelopment
Updated1d ago
Forks93

Languages

Python

Security Score

80/100

Audited on Mar 29, 2026

No findings