andrewRowlinson / mplsoccer

Football pitch plotting library for matplotlib
MIT License
405 stars 82 forks source link

Missing parenthesis - Statsbomb.py - Read_Lineup - Getting Match_ID - TypeError: 'PosixPath' object is not subscriptable #54

Closed pakkk closed 2 years ago

pakkk commented 2 years ago

Hi,

There is a bug in Statsbomb.py (function "read_lineup") in the following line:

match_id = os.path.basename(path_or_buf[:-5])

It should be:

match_id = os.path.basename(path_or_buf)[:-5]

The current exception is "TypeError: 'PosixPath' object is not subscriptable"

My Python version is 3.7.3

Thank you!

andrewRowlinson commented 2 years ago

Thanks fixed with f76720076a534ba28d35a22bb0c34826a262b27f. I have uploaded a new version to pypi/ pip.

I am considering removing the ability to read from local files in favour of just reading from the API/ open data. Would this be a problem?

pakkk commented 2 years ago

Thanks Andrew!

I'm using your code for my Phd. about AI applied to sports :)

I'm not sure to remove the ability to read from local files:

I take advantage of this email to ask you ... Do you think it would be a good idea to parse and convert to dataFrame the three-sixty?

Cheers, Paco.

andrewRowlinson commented 2 years ago

There's actually a branch that parses the data much better: https://github.com/andrewRowlinson/mplsoccer/blob/update_1_0_7/mplsoccer/statsbomb.py

It's faster and also does the 360 data too. I haven't had time to finish the rest of the features. I could add a class to this like Sblocal for parsing local files.

pakkk commented 2 years ago

ok, many thanks for your help :)

El vie, 1 jul 2022 a las 19:38, Andrew Rowlinson @.***>) escribió:

I've actually got a branch that parses the data much better: https://github.com/andrewRowlinson/mplsoccer/blob/update_1_0_7/mplsoccer/statsbomb.py

It's faster and also does the 360 data too. I haven't had time to finish the rest of the features. I could add a class to this like Sblocal for parsing local files.

— Reply to this email directly, view it on GitHub https://github.com/andrewRowlinson/mplsoccer/issues/54#issuecomment-1172573088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC5HPSVY5M4V6QUNJZV47LVR4UJHANCNFSM52KISOGQ . You are receiving this because you authored the thread.Message ID: @.***>