PySport / kloppy

kloppy: standardizing soccer tracking- and event data
https://kloppy.pysport.org
BSD 3-Clause "New" or "Revised" License
326 stars 55 forks source link

Add statistics attribute to DataRecord #302

Open DriesDeprest opened 3 months ago

DriesDeprest commented 3 months ago

Related to: https://github.com/PySport/kloppy/issues/280.

I've started with adding support for xG statistics and wanted to get initial feedback on the implementation prior to expanding it to also parse OB values of StatsBomb and potentially other statistics.

So happy to hear your thoughts @probberechts @koenvo @JanVanHaaren

DriesDeprest commented 3 months ago

It seems that for Python versions < 3.10, we get: TypeError: dataclass() got an unexpected keyword argument 'kw_only'. But even for Python versions >= 3.10, we get: TypeError: non-default argument 'end_timestamp' follows default argument. But more generally this is the result of defining the default statistics argument in the DataRecord class prior to non-default arguments for classes which inherit from DataRecord, such as Event.

I'm not sure what the right way is to handle this, so any help is greatly appreciated, thanks.