ForzaJuve1
commited on
Update Integration.py
Browse files- Integration.py +11 -11
Integration.py
CHANGED
@@ -537,7 +537,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
537 |
)
|
538 |
|
539 |
def _split_generators(self, dl_manager):
|
540 |
-
file_url = 'https://drive.google.com/uc?
|
541 |
downloaded_file = dl_manager.download(file_url)
|
542 |
|
543 |
return [
|
@@ -593,12 +593,12 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
593 |
#Directly yield the id and row.to_dict() if the DataFrame structure matches the desired output
|
594 |
#yield id, row.to_dict()
|
595 |
with open(filepath, encoding="utf-8") as f:
|
596 |
-
reader =
|
597 |
for id, row in enumerate(reader):
|
598 |
|
599 |
match_event_str = row["MatchEvent"]
|
600 |
-
match_event_replaced = match_event_str.replace("'", '"')
|
601 |
-
match_event_replaced = match_event_str.replace(": nan: ", ": None: ")
|
602 |
match_event = yaml.safe_load(match_event_str)
|
603 |
|
604 |
team_linup_str = row["TeamLineUps"]
|
@@ -606,19 +606,19 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
606 |
team_linup = ast.literal_eval(team_linup_replaced)
|
607 |
|
608 |
team_stats_str = row["TeamStats"]
|
609 |
-
team_stats_replaced = team_stats_str.replace("'", '"')
|
610 |
-
team_stats_replaced = team_stats_replaced.replace(": nan", ": null")
|
611 |
team_stats = yaml.safe_load(team_stats_str)
|
612 |
|
613 |
player_stats_str = row["PlayerStats"]
|
614 |
-
player_stats_replaced = player_stats_str.replace("'", '"')
|
615 |
-
player_stats_replaced = player_stats_replaced.replace(": nan", ": null")
|
616 |
player_stats_replaced = player_stats_str.replace('"', '\"')
|
617 |
player_stats = yaml.safe_load(player_stats_replaced)
|
618 |
|
619 |
pre_match_str = row["PlayerPreMatchInfo"]
|
620 |
-
pre_match_replaced = pre_match_str.replace("'", '"')
|
621 |
-
pre_match_replaced = pre_match_replaced.replace(": nan", ": null")
|
622 |
pre_match_info = yaml.safe_load(pre_match_str)
|
623 |
|
624 |
yield id, {
|
@@ -648,7 +648,7 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
648 |
"Temperature": row["Temperature"],
|
649 |
"WindSpeed": row["WindSpeed"],
|
650 |
"MatchEvent": match_event,
|
651 |
-
"TeamLineUps":
|
652 |
"TeamStats": team_stats,
|
653 |
"PlayerStats": player_stats,
|
654 |
"PlayerPreMatchInfo": pre_match_info
|
|
|
537 |
)
|
538 |
|
539 |
def _split_generators(self, dl_manager):
|
540 |
+
file_url = 'https://drive.google.com/uc?id=1RKoAQwq68LASd4ret_OKYUkF4B4m6hnu'
|
541 |
downloaded_file = dl_manager.download(file_url)
|
542 |
|
543 |
return [
|
|
|
593 |
#Directly yield the id and row.to_dict() if the DataFrame structure matches the desired output
|
594 |
#yield id, row.to_dict()
|
595 |
with open(filepath, encoding="utf-8") as f:
|
596 |
+
reader = csv.DictReader(f)
|
597 |
for id, row in enumerate(reader):
|
598 |
|
599 |
match_event_str = row["MatchEvent"]
|
600 |
+
#match_event_replaced = match_event_str.replace("'", '"')
|
601 |
+
#match_event_replaced = match_event_str.replace(": nan: ", ": None: ")
|
602 |
match_event = yaml.safe_load(match_event_str)
|
603 |
|
604 |
team_linup_str = row["TeamLineUps"]
|
|
|
606 |
team_linup = ast.literal_eval(team_linup_replaced)
|
607 |
|
608 |
team_stats_str = row["TeamStats"]
|
609 |
+
#team_stats_replaced = team_stats_str.replace("'", '"')
|
610 |
+
#team_stats_replaced = team_stats_replaced.replace(": nan", ": null")
|
611 |
team_stats = yaml.safe_load(team_stats_str)
|
612 |
|
613 |
player_stats_str = row["PlayerStats"]
|
614 |
+
#player_stats_replaced = player_stats_str.replace("'", '"')
|
615 |
+
#player_stats_replaced = player_stats_replaced.replace(": nan", ": null")
|
616 |
player_stats_replaced = player_stats_str.replace('"', '\"')
|
617 |
player_stats = yaml.safe_load(player_stats_replaced)
|
618 |
|
619 |
pre_match_str = row["PlayerPreMatchInfo"]
|
620 |
+
#pre_match_replaced = pre_match_str.replace("'", '"')
|
621 |
+
#pre_match_replaced = pre_match_replaced.replace(": nan", ": null")
|
622 |
pre_match_info = yaml.safe_load(pre_match_str)
|
623 |
|
624 |
yield id, {
|
|
|
648 |
"Temperature": row["Temperature"],
|
649 |
"WindSpeed": row["WindSpeed"],
|
650 |
"MatchEvent": match_event,
|
651 |
+
"TeamLineUps": team_linup,
|
652 |
"TeamStats": team_stats,
|
653 |
"PlayerStats": player_stats,
|
654 |
"PlayerPreMatchInfo": pre_match_info
|