ForzaJuve1 commited on
Commit
4b1ad75
1 Parent(s): 75aaa26

Update Integration.py

Browse files
Files changed (1) hide show
  1. Integration.py +10 -16
Integration.py CHANGED
@@ -4,7 +4,6 @@ import tensorflow as tf
4
  import csv
5
  import sys
6
  import ast
7
- import demjson
8
 
9
  class Euro2020Dataset(GeneratorBasedBuilder):
10
  VERSION = "1.0.0"
@@ -571,18 +570,13 @@ class Euro2020Dataset(GeneratorBasedBuilder):
571
  "5-Penalty Shootout": match_event.get("5-Penalty Shootout", []),
572
  }
573
 
574
- team_lineup_str = row["TeamLineUps"]
575
- try:
576
- team_lineup = ast.literal_eval(team_lineup_str)
577
- except ValueError:
578
- team_lineup = {}
579
-
580
- team_lineup_processed = {
581
- "HomeTeamLineUp": team_lineup.get("HomeTeamLineUp"),
582
- "AwayTeamLineUp": team_lineup.get("AwayTeamLineUp"),
583
- }
584
 
585
- team_linup = demjson.decode(team_lineup_str)
 
 
 
 
586
 
587
  #team_stats_str = row["TeamStats"]
588
  #team_stats = json.loads(team_stats_str)
@@ -618,7 +612,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
618
  "AwayTeamPlayerInfo": pre_match_info.get("AwayTeamPlayerInfo"),
619
  }
620
 
621
- ppi = demjson.decode(pre_match_info_str)
622
 
623
 
624
  yield id, {
@@ -648,9 +642,9 @@ class Euro2020Dataset(GeneratorBasedBuilder):
648
  "Temperature": row["Temperature"],
649
  "WindSpeed": row["WindSpeed"],
650
  "MatchEvent": match_event_processed,
651
- "TeamLineUps": team_linup,
652
- #"TeamStats": team_stats,
653
  #"PlayerStats": player_stats,
654
- "PlayerPreMatchInfo": ppi,
655
  }
656
 
 
4
  import csv
5
  import sys
6
  import ast
 
7
 
8
  class Euro2020Dataset(GeneratorBasedBuilder):
9
  VERSION = "1.0.0"
 
570
  "5-Penalty Shootout": match_event.get("5-Penalty Shootout", []),
571
  }
572
 
573
+ #team_lineup_str = row["TeamLineUps"]
 
 
 
 
 
 
 
 
 
574
 
575
+ team_stats_str_corrected = team_stats_str.replace("'", '"')
576
+ try:
577
+ team_stats = json.loads(team_stats_str_corrected)
578
+ except json.JSONDecodeError as e:
579
+ print(f"Error decoding JSON: {e}")
580
 
581
  #team_stats_str = row["TeamStats"]
582
  #team_stats = json.loads(team_stats_str)
 
612
  "AwayTeamPlayerInfo": pre_match_info.get("AwayTeamPlayerInfo"),
613
  }
614
 
615
+
616
 
617
 
618
  yield id, {
 
642
  "Temperature": row["Temperature"],
643
  "WindSpeed": row["WindSpeed"],
644
  "MatchEvent": match_event_processed,
645
+ #"TeamLineUps": team_linup,
646
+ "TeamStats": team_stats,
647
  #"PlayerStats": player_stats,
648
+ #"PlayerPreMatchInfo": ppi,
649
  }
650