socceraction.data.statsbomb.StatsBombLoader

class socceraction.data.statsbomb.StatsBombLoader(getter='remote', root=None, creds=None)

Load Statsbomb data either from a remote location or from a local folder.

To load remote data, this loader uses the statsbombpy package. Data can be retrieved from the StatsBomb API and from the Open Data GitHub repo. API access is for paying customers only. Authentication can be done by setting environment variables named SB_USERNAME and SB_PASSWORD to your login credentials. Alternatively, pass your login credentials using the creds parameter. StatsBomb’s open data can be accessed without the need of authentication but its use is subject to a user agreement.

To load local data, point root to the root folder of the data. This folder should use the same directory structure as used in the Open Data GitHub repo.

Parameters:
  • getter (str) – “remote” or “local”

  • root (str, optional) – Root-path of the data. Only used when getter is “local”.

  • creds (dict, optional) – Login credentials in the format {“user”: “”, “passwd”: “”}. Only used when getter is “remote”.

Methods

__init__

competitions

Return a dataframe with all available competitions and seasons.

events

Return a dataframe with the event stream of a game.

games

Return a dataframe with all available games in a season.

players

Return a dataframe with all players that participated in a game.

teams

Return a dataframe with both teams that participated in a game.