Open nepito opened 3 months ago
Otro ejemplo:
Con los datos:
shot = {'player': {'name': 'Jesús Gallardo', 'slug': 'jesus-gallardo', 'shortName': 'J. Gallardo', 'position': 'D', 'jerseyNumber': '17', 'userCount': 288, 'id': 770253, 'fieldTranslations': {'nameTranslation': {'ar': 'خيسوس غالاردو'}, 'shortNameTranslation': {'ar': 'خ. غالاردو'}}}, 'isHome': False, 'shotType': 'goal', 'goalType': 'regular', 'situation': 'corner', 'playerCoordinates': {'x': 5.4, 'y': 50.9, 'z': 0}, 'bodyPart': 'head', 'goalMouthLocation': 'high-centre', 'goalMouthCoordinates': {'x': 0, 'y': 48.4, 'z': 31.6}, 'id': 2609096, 'time': 57, 'timeSeconds': 3400, 'draw': {'start': {'x': 50.9, 'y': 5.4}, 'end': {'x': 51.6, 'y': 0}, 'goal': {'x': 51.6, 'y': 68.4}}, 'reversedPeriodTime': 34, 'reversedPeriodTimeSeconds': 2000, 'incidentType': 'shot'}
am |>
group_by(teamId) |>
summarize(
xg = sum(expectedGoals),
shoots = n(),
xGoT = sum(expectedGoalsOnTarget, na.rm = T)
) |>
pivot_longer(cols=2:4, names_to="metrica",values_to="values")
Aquí podemos encontrar las estadísticas del partido:
json_fotmob["props"]["pageProps"]["content"]["stats"]["Periods"]["All"]["stats"][0]["stats"]
Debería de poder reproducir con los siguientes datos:
Referencias