andrewRowlinson / mplsoccer

Football pitch plotting library for matplotlib
MIT License
391 stars 80 forks source link

Fix timestamp conversion for match data #88

Closed obreit closed 1 year ago

obreit commented 1 year ago

Sbopen().match() can crash for certain competitions due to a discrepancy in time formats of the last_updated column. For example, competition = 37, season = 42

Screenshot 2023-04-26 at 12 55 18

Small script that can be used to check how it behaves

from mplsoccer import statsbomb

loader = statsbomb.Sbopen()

competitions = loader.competition()

for comp in competitions[['competition_id', 'season_id']].to_dict(orient='records'):
    print(comp)
    loader.match(competition_id=comp['competition_id'], season_id=comp['season_id'])
andrewRowlinson commented 1 year ago

Thanks for noticing this - I changed the code so it works with pandas versions below 2.