ForzaJuve1
commited on
Commit
•
e85a751
1
Parent(s):
c40c3aa
Update Integration.py
Browse files- Integration.py +4 -51
Integration.py
CHANGED
@@ -570,56 +570,9 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
570 |
"4-Extra Time Second Half": match_event.get("4-Extra Time Second Half", []),
|
571 |
"5-Penalty Shootout": match_event.get("5-Penalty Shootout", []),
|
572 |
}
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
"Country": "",
|
577 |
-
"ID": 0,
|
578 |
-
"OfficialName": "",
|
579 |
-
"OfficialSurname": "",
|
580 |
-
"ShortName": "",
|
581 |
-
"Role": "",
|
582 |
-
"JerseyNumber": "",
|
583 |
-
"IsGoalkeeper": "",
|
584 |
-
"JerseyName": "",
|
585 |
-
"IsCaptain": "",
|
586 |
-
"TacticX": "",
|
587 |
-
"TacticY": "",
|
588 |
-
"Numorder": "",
|
589 |
-
"IsBooked": 0.0,
|
590 |
-
}
|
591 |
-
|
592 |
-
default_staff = {
|
593 |
-
"Country": "",
|
594 |
-
"ID": 0,
|
595 |
-
"OfficialName": "",
|
596 |
-
"OfficialSurname": "",
|
597 |
-
"ShortName": "",
|
598 |
-
"Role": "",
|
599 |
-
}
|
600 |
-
|
601 |
-
# Default structure for a team lineup
|
602 |
-
default_team_lineup = {
|
603 |
-
"Starting11": [default_player],
|
604 |
-
"Benched Players": [default_player],
|
605 |
-
"Staff": [default_staff],
|
606 |
-
}
|
607 |
-
|
608 |
-
# The final default structure to use when 'HomeTeamLineUp' or 'AwayTeamLineUp' data is missing or malformed
|
609 |
-
default_team_lineups_structure = {
|
610 |
-
"HomeTeamLineUp": default_team_lineup,
|
611 |
-
"AwayTeamLineUp": default_team_lineup,
|
612 |
-
}
|
613 |
-
team_lineups_str = row["TeamLineUps"]
|
614 |
-
try:
|
615 |
-
team_lineups = ast.literal_eval(team_lineups_str)
|
616 |
-
except ValueError:
|
617 |
-
team_lineups = default_team_lineups_structure
|
618 |
-
|
619 |
-
team_lineups_processed = {
|
620 |
-
"HomeTeamLineUp": team_lineups["HomeTeamLineUp"],
|
621 |
-
"AwayTeamLineUp": team_lineups["AwayTeamLineUp"],
|
622 |
-
}
|
623 |
|
624 |
yield id, {
|
625 |
"HomeTeamName": row["HomeTeamName"],
|
@@ -648,7 +601,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
648 |
"Temperature": row["Temperature"],
|
649 |
"WindSpeed": row["WindSpeed"],
|
650 |
"MatchEvent": match_event_processed,
|
651 |
-
"TeamLineUps":
|
652 |
#"TeamStats": team_stats,
|
653 |
#"PlayerStats": player_stats,
|
654 |
#"PlayerPreMatchInfo": ppi,
|
|
|
570 |
"4-Extra Time Second Half": match_event.get("4-Extra Time Second Half", []),
|
571 |
"5-Penalty Shootout": match_event.get("5-Penalty Shootout", []),
|
572 |
}
|
573 |
+
team_linup_str = row["TeamLineUps"]
|
574 |
+
team_linup_replaced = team_linup_str.replace(": nan", ": None")
|
575 |
+
team_linup = ast.literal_eval(team_linup_replaced)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
|
577 |
yield id, {
|
578 |
"HomeTeamName": row["HomeTeamName"],
|
|
|
601 |
"Temperature": row["Temperature"],
|
602 |
"WindSpeed": row["WindSpeed"],
|
603 |
"MatchEvent": match_event_processed,
|
604 |
+
"TeamLineUps": team_linup,
|
605 |
#"TeamStats": team_stats,
|
606 |
#"PlayerStats": player_stats,
|
607 |
#"PlayerPreMatchInfo": ppi,
|