I keep getting various problems and issues trying to create an xG shot map of a specific game, now being a TypeError. Any help to get a running code would be helpful
ps someone has a similar code submitted with similar problem
world_cup = sb.matches(competition_id=43,season_id=3)
event = sb.events(match_id=8656)
X = [x for x, y in (event["location"])]
Y = [y for x, y in (event["location"])]
pitch = Pitch(pitch_type='statsbomb', pitch_color='#22312b', line_color='#c7d5cc',half=False,pad_bottom=0.5)
fig,ax = pitch.draw(figsize=(16, 11), constrained_layout=True, tight_layout=False)
for i in range(len(event["shot_outcome"])):
if event["shot_outcome"][i] == "Goal":
pitch.scatter(X[i], Y[i], s=event["shot_statsbomb_xg"][i]*1000, c="green",ax=ax)
else:
pitch.scatter(X[i], Y[i], s=event["shot_statsbomb_xg"][i]*1000, c="red", alpha=0.5,ax=ax)
fig.suptitle("England vs Croatia SF WC-2018", fontsize=20, color="White", fontweight='bold', fontfamily="Monospace")
fig.set_size_inches(15, 7)
fig.set_facecolor("#0f1029")
plt.show()