ForzaJuve1 commited on
Commit
19c0cad
1 Parent(s): cc9c415

Update Integration.py

Browse files
Files changed (1) hide show
  1. Integration.py +14 -4
Integration.py CHANGED
@@ -72,7 +72,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
72
  "PlayerToID": Value("float"),
73
  "Time": Value("string"),
74
  "MatchEventAttribute": Value("float"),
75
- }), default = []),
76
  "4-Extra Time Second Half": Sequence(Features({
77
  "Event": Value("string"),
78
  "Minute": Value("int64"),
@@ -84,7 +84,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
84
  "PlayerToID": Value("float"),
85
  "Time": Value("string"),
86
  "MatchEventAttribute": Value("float"),
87
- }), default = []),
88
  "5-Penalty Shootout": Sequence(Features({
89
  "Event": Value("string"),
90
  "Minute": Value("int64"),
@@ -96,7 +96,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
96
  "PlayerToID": Value("float"),
97
  "Time": Value("string"),
98
  "MatchEventAttribute": Value("float"),
99
- }), default = []),
100
  }),
101
  "TeamLineUps": Features({
102
  "HomeTeamLineUp": Features({
@@ -552,6 +552,16 @@ class Euro2020Dataset(GeneratorBasedBuilder):
552
  with open(filepath, encoding="utf-8") as f:
553
  reader = csv.DictReader(f)
554
  for id, row in enumerate(reader):
 
 
 
 
 
 
 
 
 
 
555
  yield id, {
556
  "HomeTeamName": row["HomeTeamName"],
557
  "AwayTeamName": row["AwayTeamName"],
@@ -578,7 +588,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
578
  "Humidity": row["Humidity"],
579
  "Temperature": row["Temperature"],
580
  "WindSpeed": row["WindSpeed"],
581
- "MatchEvent": row["MatchEvent"],
582
  "TeamLineUps": row["TeamLineUps"],
583
  "TeamStats": row["TeamStats"],
584
  "PlayerStats": row["PlayerStats"],
 
72
  "PlayerToID": Value("float"),
73
  "Time": Value("string"),
74
  "MatchEventAttribute": Value("float"),
75
+ })),
76
  "4-Extra Time Second Half": Sequence(Features({
77
  "Event": Value("string"),
78
  "Minute": Value("int64"),
 
84
  "PlayerToID": Value("float"),
85
  "Time": Value("string"),
86
  "MatchEventAttribute": Value("float"),
87
+ })),
88
  "5-Penalty Shootout": Sequence(Features({
89
  "Event": Value("string"),
90
  "Minute": Value("int64"),
 
96
  "PlayerToID": Value("float"),
97
  "Time": Value("string"),
98
  "MatchEventAttribute": Value("float"),
99
+ })),
100
  }),
101
  "TeamLineUps": Features({
102
  "HomeTeamLineUp": Features({
 
552
  with open(filepath, encoding="utf-8") as f:
553
  reader = csv.DictReader(f)
554
  for id, row in enumerate(reader):
555
+ match_event = row["MatchEvent"]
556
+
557
+ # Process each match event to ensure all expected keys exist
558
+ match_event_processed = {
559
+ "1-First Half": match_event.get("1-First Half", []),
560
+ "2-Second Half": match_event.get("2-Second Half", []),
561
+ "3-Extra Time First Half": match_event.get("3-Extra Time First Half", []),
562
+ "4-Extra Time Second Half": match_event.get("4-Extra Time Second Half", []),
563
+ "5-Penalty Shootout": match_event.get("5-Penalty Shootout", []),
564
+ }
565
  yield id, {
566
  "HomeTeamName": row["HomeTeamName"],
567
  "AwayTeamName": row["AwayTeamName"],
 
588
  "Humidity": row["Humidity"],
589
  "Temperature": row["Temperature"],
590
  "WindSpeed": row["WindSpeed"],
591
+ "MatchEvent": match_event_processed,
592
  "TeamLineUps": row["TeamLineUps"],
593
  "TeamStats": row["TeamStats"],
594
  "PlayerStats": row["PlayerStats"],