-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Right now, we do not inherintly support the use of the StatsBomb api, but only those of .json files. This issue will focus on creating a solution for that in the future.
Special thanks to @jan-swiatek for updating the code!
For those who want to use the api right now:
- install
statsbombpy:pip install statsbombpy - import statsbombpy:
from statsbombpy import sb - set credentials: see authentication statsbombpy
- obtain and save the raw files by using
fmt="dict":
For a full
import json
from statsbombpy import sb
competition_id = 9
season_id = 281
match_id = 3895302
with open(f"match.json", "w") as f:
match = sb.matches(competition_id=competition_id, season_id=season_id, fmt="dict").get(match_id)
json.dump([match], f)
with open(f"lineups.json", "w") as f:
lineups = sb.lineups(match_id=match_id, fmt="dict")
json.dump([v for k, v in lineups.items()], f)
with open(f"events.json", "w") as f:
events = sb.events(match_id=match_id, fmt="dict")
json.dump([event for _id, event in events.items()], f)- Load in the match in databallpy:
from databallpy import get_match
match = get_match(
event_data_loc="events.json",
event_match_loc="match_info.json",
event_lineup_loc="lineup_info.json",
event_data_provider="statsbomb",
)Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request