ForzaJuve1
commited on
Commit
•
42b61e0
1
Parent(s):
c5c39b1
Update Integration.py
Browse files- Integration.py +39 -39
Integration.py
CHANGED
@@ -553,17 +553,17 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
553 |
#csv.field_size_limit(sys.maxsize)
|
554 |
|
555 |
def _generate_examples(self, filepath):
|
556 |
-
table = pq.read_table(filepath)
|
557 |
-
df = table.to_pandas()
|
558 |
#df = pd.read_parquet(filepath)
|
559 |
-
for id, row in df.iterrows():
|
560 |
#'id' here is the index of the row in the DataFrame
|
561 |
#'row' is a Pandas Series object representing the row data
|
562 |
#Directly yield the id and row.to_dict() if the DataFrame structure matches the desired output
|
563 |
-
yield id, row.to_dict()
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
|
568 |
#match_event_str = row["MatchEvent"]
|
569 |
#match_event_replaced = match_event_str.replace("'", '"')
|
@@ -590,36 +590,36 @@ class Euro2020Dataset(GeneratorBasedBuilder):
|
|
590 |
#pre_match_replaced = pre_match_replaced.replace(": nan", ": null")
|
591 |
#pre_match_info = yaml.safe_load(pre_match_str)
|
592 |
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
|
|
|
553 |
#csv.field_size_limit(sys.maxsize)
|
554 |
|
555 |
def _generate_examples(self, filepath):
|
556 |
+
#table = pq.read_table(filepath)
|
557 |
+
#df = table.to_pandas()
|
558 |
#df = pd.read_parquet(filepath)
|
559 |
+
#for id, row in df.iterrows():
|
560 |
#'id' here is the index of the row in the DataFrame
|
561 |
#'row' is a Pandas Series object representing the row data
|
562 |
#Directly yield the id and row.to_dict() if the DataFrame structure matches the desired output
|
563 |
+
#yield id, row.to_dict()
|
564 |
+
with open(filepath, encoding="utf-8") as f:
|
565 |
+
reader = pd.read_parquet(f)
|
566 |
+
for id, row in enumerate(reader):
|
567 |
|
568 |
#match_event_str = row["MatchEvent"]
|
569 |
#match_event_replaced = match_event_str.replace("'", '"')
|
|
|
590 |
#pre_match_replaced = pre_match_replaced.replace(": nan", ": null")
|
591 |
#pre_match_info = yaml.safe_load(pre_match_str)
|
592 |
|
593 |
+
yield id, {
|
594 |
+
"HomeTeamName": row["HomeTeamName"],
|
595 |
+
"AwayTeamName": row["AwayTeamName"],
|
596 |
+
"DateandTimeCET": row["DateandTimeCET"],
|
597 |
+
"MatchID": row["MatchID"],
|
598 |
+
"RoundName": row["RoundName"],
|
599 |
+
"Stage": row["Stage"],
|
600 |
+
"MatchDay": row["MatchDay"],
|
601 |
+
"Session": row["Session"],
|
602 |
+
"MatchMinute": row["MatchMinute"],
|
603 |
+
"InjuryTime": row["InjuryTime"],
|
604 |
+
"NumberOfPhases": row["NumberOfPhases"],
|
605 |
+
"Phase": row["Phase"],
|
606 |
+
"ScoreHome": row["ScoreHome"],
|
607 |
+
"ScoreAway": row["ScoreAway"],
|
608 |
+
"MatchStatus": row["MatchStatus"],
|
609 |
+
"StadiumID": row["StadiumID"],
|
610 |
+
"RefereeWebName": row["RefereeWebName"],
|
611 |
+
"NumberofMatchesRefereedPostMatch": row["NumberofMatchesRefereedPostMatch"],
|
612 |
+
"TotalNumberofMatchesRefereed": row["TotalNumberofMatchesRefereed"],
|
613 |
+
"NumberofMatchesRefereedinGroupStage": row["NumberofMatchesRefereedinGroupStage"],
|
614 |
+
"NumberofMatchesRefereedinKnockoutStage": row["NumberofMatchesRefereedinKnockoutStage"],
|
615 |
+
"AssistantRefereeWebName": row["AssistantRefereeWebName"],
|
616 |
+
"Humidity": row["Humidity"],
|
617 |
+
"Temperature": row["Temperature"],
|
618 |
+
"WindSpeed": row["WindSpeed"],
|
619 |
+
"MatchEvent": row["MatchEvent"],
|
620 |
+
"TeamLineUps": row["TeamLineUps"],
|
621 |
+
"TeamStats": row["TeamStats"],
|
622 |
+
"PlayerStats": row["PlayerStats"],
|
623 |
+
"PlayerPreMatchInfo": row["PlayerPreMatchInfo"],
|
624 |
+
}
|
625 |
|