You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TimeContainer was added to store player positions, however it seems that (haven’t tested it with other data) when loading the open skillcorner data default match, I sometimes get an “empty” TimeContainer, something like this:
I don't think this should happen, if only because if I now try to call player.positions.at_start() it throws a KeyError because it has no self.items. Why are we raising a KeyError. It should instead be something like Position.NOT_SET (assuming this is the reason the TimeContainer is empty).
def at_start(self):
"""Return the value at the beginning of the match"""
if not self.items:
raise KeyError
first_item: Time = self.items.keys()[0]
tmp_period = first_item.period
while tmp_period.prev_period:
tmp_period = tmp_period.prev_period
return self.value_at(Time.from_period(tmp_period, "start"))
Above is the code that raises the issue. Below is an MRE.
from kloppy import skillcorner
dataset = skillcorner.load_open_data(
coordinates="secondspectrum",
include_empty_frames=False,
limit=10
)
for frame in dataset:
for pid in frame.players_data:
print(pid.positions)
The text was updated successfully, but these errors were encountered:
The TimeContainer was added to store player positions, however it seems that (haven’t tested it with other data) when loading the open skillcorner data default match, I sometimes get an “empty” TimeContainer, something like this:
I don't think this should happen, if only because if I now try to call
player.positions.at_start()
it throws a KeyError because it has no self.items. Why are we raising a KeyError. It should instead be something like Position.NOT_SET (assuming this is the reason the TimeContainer is empty).Above is the code that raises the issue. Below is an MRE.
The text was updated successfully, but these errors were encountered: