When a match goes into penalty shootout, the XML generation fails because of the following code section:
# define function to calculate start time
def start_time(gameTimeInSec, periodId):
# get period offset
offset = offsets[f"p{periodId}"]
# calculate and return start time
return max(gameTimeInSec - (periodId - 1) * 10000 + offset - lead, 0)
# define function to calculate end time
def end_time(gameTimeInSec, periodId, duration):
# get period offset
offset = offsets[f"p{periodId}"]
# calculate and return end time
return gameTimeInSec - (periodId - 1) * 10000 + offset + duration + lag
# apply start and end time functions
events["start"] = events.apply(
lambda x: start_time(x["gameTimeInSec"], x["periodId"]), axis=1)
events["end"] = events.apply(
lambda x: end_time(x["gameTimeInSec"], x["periodId"], x["duration"]), axis=1)
Penalty shootouts have the period_id = 5 but there is no timestamp input for the function for p = 5. A new input has to be added to account for penalty shootouts.
When a match goes into penalty shootout, the XML generation fails because of the following code section:
Penalty shootouts have the
period_id = 5
but there is no timestamp input for the function forp = 5
. A new input has to be added to account for penalty shootouts.