ForzaJuve1 commited on
Commit
f4e82a4
1 Parent(s): 42b61e0

Update Integration.py

Browse files
Files changed (1) hide show
  1. Integration.py +39 -35
Integration.py CHANGED
@@ -553,6 +553,10 @@ 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)
@@ -561,9 +565,9 @@ class Euro2020Dataset(GeneratorBasedBuilder):
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,36 +594,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
- 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
 
 
553
  #csv.field_size_limit(sys.maxsize)
554
 
555
  def _generate_examples(self, filepath):
556
+ table = pq.read_table(filepath)
557
+ for batch in table.to_batches():
558
+ for row in batch.to_pydict():
559
+ yield row
560
  #table = pq.read_table(filepath)
561
  #df = table.to_pandas()
562
  #df = pd.read_parquet(filepath)
 
565
  #'row' is a Pandas Series object representing the row data
566
  #Directly yield the id and row.to_dict() if the DataFrame structure matches the desired output
567
  #yield id, row.to_dict()
568
+ #with open(filepath, encoding="utf-8") as f:
569
+ #reader = pd.read_parquet(f)
570
+ #for id, row in enumerate(reader):
571
 
572
  #match_event_str = row["MatchEvent"]
573
  #match_event_replaced = match_event_str.replace("'", '"')
 
594
  #pre_match_replaced = pre_match_replaced.replace(": nan", ": null")
595
  #pre_match_info = yaml.safe_load(pre_match_str)
596
 
597
+ #yield id, {
598
+ #"HomeTeamName": row["HomeTeamName"],
599
+ #"AwayTeamName": row["AwayTeamName"],
600
+ #"DateandTimeCET": row["DateandTimeCET"],
601
+ #"MatchID": row["MatchID"],
602
+ #"RoundName": row["RoundName"],
603
+ #"Stage": row["Stage"],
604
+ #"MatchDay": row["MatchDay"],
605
+ #"Session": row["Session"],
606
+ #"MatchMinute": row["MatchMinute"],
607
+ #"InjuryTime": row["InjuryTime"],
608
+ #"NumberOfPhases": row["NumberOfPhases"],
609
+ #"Phase": row["Phase"],
610
+ #"ScoreHome": row["ScoreHome"],
611
+ #"ScoreAway": row["ScoreAway"],
612
+ #"MatchStatus": row["MatchStatus"],
613
+ #"StadiumID": row["StadiumID"],
614
+ #"RefereeWebName": row["RefereeWebName"],
615
+ #"NumberofMatchesRefereedPostMatch": row["NumberofMatchesRefereedPostMatch"],
616
+ #"TotalNumberofMatchesRefereed": row["TotalNumberofMatchesRefereed"],
617
+ #"NumberofMatchesRefereedinGroupStage": row["NumberofMatchesRefereedinGroupStage"],
618
+ #"NumberofMatchesRefereedinKnockoutStage": row["NumberofMatchesRefereedinKnockoutStage"],
619
+ #"AssistantRefereeWebName": row["AssistantRefereeWebName"],
620
+ #"Humidity": row["Humidity"],
621
+ #"Temperature": row["Temperature"],
622
+ #"WindSpeed": row["WindSpeed"],
623
+ #"MatchEvent": row["MatchEvent"],
624
+ #"TeamLineUps": row["TeamLineUps"],
625
+ #"TeamStats": row["TeamStats"],
626
+ #"PlayerStats": row["PlayerStats"],
627
+ #"PlayerPreMatchInfo": row["PlayerPreMatchInfo"],
628
+ #}
629