ForzaJuve1 commited on
Commit
ea0b52d
·
verified ·
1 Parent(s): 4752fc4

Delete Integration.py

Browse files
Files changed (1) hide show
  1. Integration.py +0 -656
Integration.py DELETED
@@ -1,656 +0,0 @@
1
- from datasets import Dataset, GeneratorBasedBuilder, DatasetInfo, Features, Value, SplitGenerator, Sequence
2
- import pandas as pd
3
- import tensorflow as tf
4
- import csv
5
- import sys
6
- import ast
7
- import json
8
- import yaml
9
- import pyarrow.parquet as pq
10
-
11
- class Euro2020Dataset(GeneratorBasedBuilder):
12
- VERSION = "1.0.0"
13
-
14
- def _info(self):
15
- return DatasetInfo(
16
- description="Your dataset description here.",
17
- features=Features({
18
- "HomeTeamName": Value("string"),
19
- "AwayTeamName": Value("string"),
20
- "DateandTimeCET": Value("string"),
21
- "MatchID": Value("int64"),
22
- "RoundName": Value("string"),
23
- "Stage": Value("string"),
24
- "MatchDay": Value("int64"),
25
- "Session": Value("int64"),
26
- "MatchMinute": Value("int64"),
27
- "InjuryTime": Value("int64"),
28
- "NumberofPhases": Value("int64"),
29
- "Phase": Value("int64"),
30
- "ScoreHome": Value("int64"),
31
- "ScoreAway": Value("int64"),
32
- "MatchStatus": Value("string"),
33
- "StadiumID": Value("int64"),
34
- "RefereeWebName": Value("string"),
35
- "NumberofMatchesRefereedPostMatch": Value("int64"),
36
- "TotalNumberofMatchesRefereed": Value("int64"),
37
- "NumberofMatchesRefereedinGroupStage": Value("int64"),
38
- "NumberofMatchesRefereedinKnockoutStage": Value("int64"),
39
- "AssistantRefereeWebName": Value("string"),
40
- "Humidity": Value("int64"),
41
- "Temperature": Value("int64"),
42
- "WindSpeed": Value("int64"),
43
- "MatchEvent": Features({
44
- "1-First Half": Sequence(Features({
45
- "Event": Value("string"),
46
- "Minute": Value("int64"),
47
- "Phase": Value("int64"),
48
- "InjuryMinute": Value("int64"),
49
- "TeamFromID": Value("float"),
50
- "TeamToID": Value("float"),
51
- "PlayerFromID": Value("float"),
52
- "PlayerToID": Value("float"),
53
- "Time": Value("string"),
54
- "MatchEventAttribute": Value("string"), # contains both nan (float) and string, so use string to
55
- # accommadate both
56
- })),
57
- "2-Second Half": Sequence(Features({
58
- "Event": Value("string"),
59
- "Minute": Value("int64"),
60
- "Phase": Value("int64"),
61
- "InjuryMinute": Value("int64"),
62
- "TeamFromID": Value("float"),
63
- "TeamToID": Value("float"),
64
- "PlayerFromID": Value("float"),
65
- "PlayerToID": Value("float"),
66
- "Time": Value("string"),
67
- "MatchEventAttribute": Value("string"),
68
- })),
69
- "3-Extra Time First Half": Sequence(Features({
70
- "Event": Value("string"),
71
- "Minute": Value("int64"),
72
- "Phase": Value("int64"),
73
- "InjuryMinute": Value("int64"),
74
- "TeamFromID": Value("float"),
75
- "TeamToID": Value("float"),
76
- "PlayerFromID": Value("float"),
77
- "PlayerToID": Value("float"),
78
- "Time": Value("string"),
79
- "MatchEventAttribute": Value("string"),
80
- })),
81
- "4-Extra Time Second Half": Sequence(Features({
82
- "Event": Value("string"),
83
- "Minute": Value("int64"),
84
- "Phase": Value("int64"),
85
- "InjuryMinute": Value("int64"),
86
- "TeamFromID": Value("float"),
87
- "TeamToID": Value("float"),
88
- "PlayerFromID": Value("float"),
89
- "PlayerToID": Value("float"),
90
- "Time": Value("string"),
91
- "MatchEventAttribute": Value("string"),
92
- })),
93
- "5-Penalty Shootout": Sequence(Features({
94
- "Event": Value("string"),
95
- "Minute": Value("int64"),
96
- "Phase": Value("int64"),
97
- "InjuryMinute": Value("int64"),
98
- "TeamFromID": Value("float"),
99
- "TeamToID": Value("float"),
100
- "PlayerFromID": Value("float"),
101
- "PlayerToID": Value("float"),
102
- "Time": Value("string"),
103
- "MatchEventAttribute": Value("string"),
104
- })),
105
- }),
106
- "TeamLineUps": Features({
107
- "HomeTeamLineUp": Features({
108
- "Starting11": Sequence(Features({
109
- "Country": Value("string"),
110
- "ID": Value("int64"),
111
- "OfficialName": Value("string"),
112
- "OfficialSurname": Value("string"),
113
- "ShortName": Value("string"),
114
- "Role": Value("string"),
115
- "JerseyNumber": Value("string"),
116
- "IsGoalkeeper": Value("string"),
117
- "JerseyName": Value("string"),
118
- "IsCaptain": Value("string"),
119
- "TacticX": Value("string"),
120
- "TacticY": Value("string"),
121
- "Numorder": Value("string"),
122
- "IsBooked": Value("float"),
123
- })),
124
- "Benched Players": Sequence(Features({
125
- "Country": Value("string"),
126
- "ID": Value("int64"),
127
- "OfficialName": Value("string"),
128
- "OfficialSurname": Value("string"),
129
- "ShortName": Value("string"),
130
- "Role": Value("string"),
131
- "JerseyNumber": Value("string"),
132
- "IsGoalkeeper": Value("string"),
133
- "JerseyName": Value("string"),
134
- "IsCaptain": Value("string"),
135
- "TacticX": Value("string"),
136
- "TacticY": Value("string"),
137
- "Numorder": Value("string"),
138
- "IsBooked": Value("float"),
139
- })),
140
- "Staff": Sequence(Features({
141
- "Country": Value("string"),
142
- "ID": Value("int64"),
143
- "OfficialName": Value("string"),
144
- "OfficialSurname": Value("string"),
145
- "ShortName": Value("string"),
146
- "Role": Value("string"),
147
- })),
148
- }),
149
- "AwayTeamLineUp": Features({
150
- "Starting11": Sequence(Features({
151
- "Country": Value("string"),
152
- "ID": Value("int64"),
153
- "OfficialName": Value("string"),
154
- "OfficialSurname": Value("string"),
155
- "ShortName": Value("string"),
156
- "Role": Value("string"),
157
- "JerseyNumber": Value("string"),
158
- "IsGoalkeeper": Value("string"),
159
- "JerseyName": Value("string"),
160
- "IsCaptain": Value("string"),
161
- "TacticX": Value("string"),
162
- "TacticY": Value("string"),
163
- "Numorder": Value("string"),
164
- "IsBooked": Value("float"),
165
- })),
166
- "Benched Players": Sequence(Features({
167
- "Country": Value("string"),
168
- "ID": Value("int64"),
169
- "OfficialName": Value("string"),
170
- "OfficialSurname": Value("string"),
171
- "ShortName": Value("string"),
172
- "Role": Value("string"),
173
- "JerseyNumber": Value("string"),
174
- "IsGoalkeeper": Value("string"),
175
- "JerseyName": Value("string"),
176
- "IsCaptain": Value("string"),
177
- "TacticX": Value("string"),
178
- "TacticY": Value("string"),
179
- "Numorder": Value("string"),
180
- "IsBooked": Value("float"),
181
- })),
182
- "Staff": Sequence(Features({
183
- "Country": Value("string"),
184
- "ID": Value("int64"),
185
- "OfficialName": Value("string"),
186
- "OfficialSurname": Value("string"),
187
- "ShortName": Value("string"),
188
- "Role": Value("string"),
189
- })),
190
- }),
191
- }),
192
- "TeamStats": Features({
193
- "HomeTeamStats": Features({
194
- "attacking": Sequence(Features({
195
- "TeamID": Value("int64"),
196
- "TeamName": Value("string"),
197
- "StatsID": Value("int64"),
198
- "StatsName": Value("string"),
199
- "Value": Value("string"),
200
- "Rank": Value("int64"),
201
- })),
202
- "coverage&speed": Sequence(Features({
203
- "TeamID": Value("int64"),
204
- "TeamName": Value("string"),
205
- "StatsID": Value("int64"),
206
- "StatsName": Value("string"),
207
- "Value": Value("string"),
208
- "Rank": Value("int64"),
209
- })),
210
- "defending": Sequence(Features({
211
- "TeamID": Value("int64"),
212
- "TeamName": Value("string"),
213
- "StatsID": Value("int64"),
214
- "StatsName": Value("string"),
215
- "Value": Value("string"),
216
- "Rank": Value("int64"),
217
- })),
218
- "goalkeeping": Sequence(Features({
219
- "TeamID": Value("int64"),
220
- "TeamName": Value("string"),
221
- "StatsID": Value("int64"),
222
- "StatsName": Value("string"),
223
- "Value": Value("string"),
224
- "Rank": Value("int64"),
225
- })),
226
- "matches played": Sequence(Features({
227
- "TeamID": Value("int64"),
228
- "TeamName": Value("string"),
229
- "StatsID": Value("int64"),
230
- "StatsName": Value("string"),
231
- "Value": Value("string"),
232
- "Rank": Value("int64"),
233
- })),
234
- "possession": Sequence(Features({
235
- "TeamID": Value("int64"),
236
- "TeamName": Value("string"),
237
- "StatsID": Value("int64"),
238
- "StatsName": Value("string"),
239
- "Value": Value("string"),
240
- "Rank": Value("int64"),
241
- })),
242
- "time stats": Sequence(Features({
243
- "TeamID": Value("int64"),
244
- "TeamName": Value("string"),
245
- "StatsID": Value("int64"),
246
- "StatsName": Value("string"),
247
- "Value": Value("string"),
248
- "Rank": Value("int64"),
249
- })),
250
- "violation&foul&discipline": Sequence(Features({
251
- "TeamID": Value("int64"),
252
- "TeamName": Value("string"),
253
- "StatsID": Value("int64"),
254
- "StatsName": Value("string"),
255
- "Value": Value("string"),
256
- "Rank": Value("int64"),
257
- })),
258
- }),
259
- "AwayTeamStats": Features({
260
- "attacking": Sequence(Features({
261
- "TeamID": Value("int64"),
262
- "TeamName": Value("string"),
263
- "StatsID": Value("int64"),
264
- "StatsName": Value("string"),
265
- "Value": Value("string"),
266
- "Rank": Value("int64"),
267
- })),
268
- "coverage&speed": Sequence(Features({
269
- "TeamID": Value("int64"),
270
- "TeamName": Value("string"),
271
- "StatsID": Value("int64"),
272
- "StatsName": Value("string"),
273
- "Value": Value("string"),
274
- "Rank": Value("int64"),
275
- })),
276
- "defending": Sequence(Features({
277
- "TeamID": Value("int64"),
278
- "TeamName": Value("string"),
279
- "StatsID": Value("int64"),
280
- "StatsName": Value("string"),
281
- "Value": Value("string"),
282
- "Rank": Value("int64"),
283
- })),
284
- "goalkeeping": Sequence(Features({
285
- "TeamID": Value("int64"),
286
- "TeamName": Value("string"),
287
- "StatsID": Value("int64"),
288
- "StatsName": Value("string"),
289
- "Value": Value("string"),
290
- "Rank": Value("int64"),
291
- })),
292
- "matches played": Sequence(Features({
293
- "TeamID": Value("int64"),
294
- "TeamName": Value("string"),
295
- "StatsID": Value("int64"),
296
- "StatsName": Value("string"),
297
- "Value": Value("string"),
298
- "Rank": Value("int64"),
299
- })),
300
- "possession": Sequence(Features({
301
- "TeamID": Value("int64"),
302
- "TeamName": Value("string"),
303
- "StatsID": Value("int64"),
304
- "StatsName": Value("string"),
305
- "Value": Value("string"),
306
- "Rank": Value("int64"),
307
- })),
308
- "time stats": Sequence(Features({
309
- "TeamID": Value("int64"),
310
- "TeamName": Value("string"),
311
- "StatsID": Value("int64"),
312
- "StatsName": Value("string"),
313
- "Value": Value("string"),
314
- "Rank": Value("int64"),
315
- })),
316
- "violation&foul&discipline": Sequence(Features({
317
- "TeamID": Value("int64"),
318
- "TeamName": Value("string"),
319
- "StatsID": Value("int64"),
320
- "StatsName": Value("string"),
321
- "Value": Value("string"),
322
- "Rank": Value("int64"),
323
- })),
324
- }),
325
- }),
326
- "PlayerStats": Features({
327
- "HomeTeamPlayerStats": Features({
328
- "attacking": Sequence(Features({
329
- "PlayerID": Value("int64"),
330
- "PlayerName": Value("string"),
331
- "PlayerSurname": Value("string"),
332
- "IsGoalkeeper": Value("bool"),
333
- "PlayedTime": Value("int64"),
334
- "StatsID": Value("int64"),
335
- "StatsName": Value("string"),
336
- "Value": Value("string"),
337
- "Rank": Value("int64"),
338
- })),
339
- "coverage&speed": Sequence(Features({
340
- "PlayerID": Value("int64"),
341
- "PlayerName": Value("string"),
342
- "PlayerSurname": Value("string"),
343
- "IsGoalkeeper": Value("bool"),
344
- "PlayedTime": Value("int64"),
345
- "StatsID": Value("int64"),
346
- "StatsName": Value("string"),
347
- "Value": Value("string"),
348
- "Rank": Value("int64"),
349
- })),
350
- "defending": Sequence(Features({
351
- "PlayerID": Value("int64"),
352
- "PlayerName": Value("string"),
353
- "PlayerSurname": Value("string"),
354
- "IsGoalkeeper": Value("bool"),
355
- "PlayedTime": Value("int64"),
356
- "StatsID": Value("int64"),
357
- "StatsName": Value("string"),
358
- "Value": Value("string"),
359
- "Rank": Value("int64"),
360
- })),
361
- "goalkeeping": Sequence(Features({
362
- "PlayerID": Value("int64"),
363
- "PlayerName": Value("string"),
364
- "PlayerSurname": Value("string"),
365
- "IsGoalkeeper": Value("bool"),
366
- "PlayedTime": Value("int64"),
367
- "StatsID": Value("int64"),
368
- "StatsName": Value("string"),
369
- "Value": Value("string"),
370
- "Rank": Value("int64"),
371
- })),
372
- "matches played": Sequence(Features({
373
- "PlayerID": Value("int64"),
374
- "PlayerName": Value("string"),
375
- "PlayerSurname": Value("string"),
376
- "IsGoalkeeper": Value("bool"),
377
- "PlayedTime": Value("int64"),
378
- "StatsID": Value("int64"),
379
- "StatsName": Value("string"),
380
- "Value": Value("string"),
381
- "Rank": Value("int64"),
382
- })),
383
- "possession": Sequence(Features({
384
- "PlayerID": Value("int64"),
385
- "PlayerName": Value("string"),
386
- "PlayerSurname": Value("string"),
387
- "IsGoalkeeper": Value("bool"),
388
- "PlayedTime": Value("int64"),
389
- "StatsID": Value("int64"),
390
- "StatsName": Value("string"),
391
- "Value": Value("string"),
392
- "Rank": Value("int64"),
393
- })),
394
- "time stats": Sequence(Features({
395
- "PlayerID": Value("int64"),
396
- "PlayerName": Value("string"),
397
- "PlayerSurname": Value("string"),
398
- "IsGoalkeeper": Value("bool"),
399
- "PlayedTime": Value("int64"),
400
- "StatsID": Value("int64"),
401
- "StatsName": Value("string"),
402
- "Value": Value("string"),
403
- "Rank": Value("int64"),
404
- })),
405
- "violation&foul&discipline": Sequence(Features({
406
- "PlayerID": Value("int64"),
407
- "PlayerName": Value("string"),
408
- "PlayerSurname": Value("string"),
409
- "IsGoalkeeper": Value("bool"),
410
- "PlayedTime": Value("int64"),
411
- "StatsID": Value("int64"),
412
- "StatsName": Value("string"),
413
- "Value": Value("string"),
414
- "Rank": Value("int64"),
415
- })),
416
- }),
417
- "AwayTeamPlayerStats": Features({
418
- "attacking": Sequence(Features({
419
- "PlayerID": Value("int64"),
420
- "PlayerName": Value("string"),
421
- "PlayerSurname": Value("string"),
422
- "IsGoalkeeper": Value("bool"),
423
- "PlayedTime": Value("int64"),
424
- "StatsID": Value("int64"),
425
- "StatsName": Value("string"),
426
- "Value": Value("string"),
427
- "Rank": Value("int64"),
428
- })),
429
- "coverage&speed": Sequence(Features({
430
- "PlayerID": Value("int64"),
431
- "PlayerName": Value("string"),
432
- "PlayerSurname": Value("string"),
433
- "IsGoalkeeper": Value("bool"),
434
- "PlayedTime": Value("int64"),
435
- "StatsID": Value("int64"),
436
- "StatsName": Value("string"),
437
- "Value": Value("string"),
438
- "Rank": Value("int64"),
439
- })),
440
- "defending": Sequence(Features({
441
- "PlayerID": Value("int64"),
442
- "PlayerName": Value("string"),
443
- "PlayerSurname": Value("string"),
444
- "IsGoalkeeper": Value("bool"),
445
- "PlayedTime": Value("int64"),
446
- "StatsID": Value("int64"),
447
- "StatsName": Value("string"),
448
- "Value": Value("string"),
449
- "Rank": Value("int64"),
450
- })),
451
- "goalkeeping": Sequence(Features({
452
- "PlayerID": Value("int64"),
453
- "PlayerName": Value("string"),
454
- "PlayerSurname": Value("string"),
455
- "IsGoalkeeper": Value("bool"),
456
- "PlayedTime": Value("int64"),
457
- "StatsID": Value("int64"),
458
- "StatsName": Value("string"),
459
- "Value": Value("string"),
460
- "Rank": Value("int64"),
461
- })),
462
- "matches played": Sequence(Features({
463
- "PlayerID": Value("int64"),
464
- "PlayerName": Value("string"),
465
- "PlayerSurname": Value("string"),
466
- "IsGoalkeeper": Value("bool"),
467
- "PlayedTime": Value("int64"),
468
- "StatsID": Value("int64"),
469
- "StatsName": Value("string"),
470
- "Value": Value("string"),
471
- "Rank": Value("int64"),
472
- })),
473
- "possession": Sequence(Features({
474
- "PlayerID": Value("int64"),
475
- "PlayerName": Value("string"),
476
- "PlayerSurname": Value("string"),
477
- "IsGoalkeeper": Value("bool"),
478
- "PlayedTime": Value("int64"),
479
- "StatsID": Value("int64"),
480
- "StatsName": Value("string"),
481
- "Value": Value("string"),
482
- "Rank": Value("int64"),
483
- })),
484
- "time stats": Sequence(Features({
485
- "PlayerID": Value("int64"),
486
- "PlayerName": Value("string"),
487
- "PlayerSurname": Value("string"),
488
- "IsGoalkeeper": Value("bool"),
489
- "PlayedTime": Value("int64"),
490
- "StatsID": Value("int64"),
491
- "StatsName": Value("string"),
492
- "Value": Value("string"),
493
- "Rank": Value("int64"),
494
- })),
495
- "violation&foul&discipline": Sequence(Features({
496
- "PlayerID": Value("int64"),
497
- "PlayerName": Value("string"),
498
- "PlayerSurname": Value("string"),
499
- "IsGoalkeeper": Value("bool"),
500
- "PlayedTime": Value("int64"),
501
- "StatsID": Value("int64"),
502
- "StatsName": Value("string"),
503
- "Value": Value("string"),
504
- "Rank": Value("int64"),
505
- })),
506
- }),
507
- }),
508
- "PlayerPreMatchInfo": Features({
509
- "HomeTeamPlayerInfo": Sequence(Features({
510
- "PlayerID": Value("int64"),
511
- "OfficialName": Value("string"),
512
- "OfficialSurname": Value("string"),
513
- "JerseyName": Value("string"),
514
- "ShortName": Value("string"),
515
- "GoalScored": Value("float"),
516
- "CleanSheet": Value("float"),
517
- "SuspendedIfBooked": Value("bool"),
518
- "Role": Value("string"),
519
- })),
520
- "AwayTeamPlayerInfo": Sequence(Features({
521
- "PlayerID": Value("int64"),
522
- "OfficialName": Value("string"),
523
- "OfficialSurname": Value("string"),
524
- "JerseyName": Value("string"),
525
- "ShortName": Value("string"),
526
- "GoalScored": Value("float"),
527
- "CleanSheet": Value("float"),
528
- "SuspendedIfBooked": Value("bool"),
529
- "Role": Value("string"),
530
- })),
531
- }),
532
- }),
533
- supervised_keys=None,
534
- homepage="Optional dataset homepage",
535
- license= "j",
536
- citation="Optional citation"
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 [
544
- SplitGenerator(
545
- name="train",
546
- gen_kwargs={"filepath": downloaded_file},
547
- ),
548
- ]
549
-
550
- # Increase the maximum field size limit
551
- csv.field_size_limit(sys.maxsize)
552
-
553
- def _generate_examples(self, filepath):
554
-
555
- #table = pq.read_table(filepath)
556
- #df = table.to_pandas()
557
- #df = pd.read_parquet(filepath)
558
- #for id, row in df.iterrows():
559
- #MatchEvent_dict = process_nested_dict(row.get("MatchEvent", {}))
560
- #TeamLineUps_dict = process_nested_dict(row.get("TeamLineUps", {}))
561
- #TeamStats_dict = process_nested_dict(row.get("TeamStats", {}))
562
- #PlayerStats_dict = process_nested_dict(row.get("PlayerStats", {}))
563
- #PlayerPreMatchInfo_dict = process_nested_dict(row.get("PlayerPreMatchInfo", {}))
564
- #MatchEvent_dict, TeamLineUps_dict, TeamStats_dict, PlayerStats_dict, PlayerPreMatchInfo_dict = {}, {}, {}, {}, {}
565
-
566
- #if row.get("MatchEvent",{}) is not None:
567
- #MatchEvent = row.get("MatchEvent",{})
568
- #for key in MatchEvent.keys():
569
- #MatchEvent_dict[key] = MatchEvent[key]
570
-
571
- #if row.get("TeamLineUps",{}) is not None:
572
- #TeamLineUps = row.get("TeamLineUps",{})
573
- #for key in TeamLineUps.keys():
574
- #TeamLineUps_dict[key] = TeamLineUps[key]
575
-
576
- #if row.get("TeamStats",{}) is not None:
577
- #TeamStats = row.get("TeamStats",{})
578
- #for key in TeamStats.keys():
579
- #TeamStats_dict[key] = TeamStats[key]
580
-
581
- #if row.get("PlayerStats",{}) is not None:
582
- #PlayerStats = row.get("PlayerStats",{})
583
- #for key in PlayerStats.keys():
584
- #PlayerStats_dict[key] = PlayerStats[key]
585
-
586
- #if row.get("PlayerPreMatchInfo",{}) is not None:
587
- #PlayerPreMatchInfo = row.get("PlayerPreMatchInfo",{})
588
- #for key in PlayerPreMatchInfo.keys():
589
- #PlayerPreMatchInfo_dict[key] = PlayerPreMatchInfo[key]
590
-
591
- #'id' here is the index of the row in the DataFrame
592
- #'row' is a Pandas Series object representing the row data
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"]
605
- team_linup_replaced = team_linup_str.replace(": nan", ": None")
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, {
625
- "HomeTeamName": row["HomeTeamName"],
626
- "AwayTeamName": row["AwayTeamName"],
627
- "DateandTimeCET": row["DateandTimeCET"],
628
- "MatchID": row["MatchID"],
629
- "RoundName": row["RoundName"],
630
- "Stage": row["Stage"],
631
- "MatchDay": row["MatchDay"],
632
- "Session": row["Session"],
633
- "MatchMinute": row["MatchMinute"],
634
- "InjuryTime": row["InjuryTime"],
635
- "NumberOfPhases": row["NumberOfPhases"],
636
- "Phase": row["Phase"],
637
- "ScoreHome": row["ScoreHome"],
638
- "ScoreAway": row["ScoreAway"],
639
- "MatchStatus": row["MatchStatus"],
640
- "StadiumID": row["StadiumID"],
641
- "RefereeWebName": row["RefereeWebName"],
642
- "NumberofMatchesRefereedPostMatch": row["NumberofMatchesRefereedPostMatch"],
643
- "TotalNumberofMatchesRefereed": row["TotalNumberofMatchesRefereed"],
644
- "NumberofMatchesRefereedinGroupStage": row["NumberofMatchesRefereedinGroupStage"],
645
- "NumberofMatchesRefereedinKnockoutStage": row["NumberofMatchesRefereedinKnockoutStage"],
646
- "AssistantRefereeWebName": row["AssistantRefereeWebName"],
647
- "Humidity": row["Humidity"],
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,
655
- }
656
-