datafc 1.3.0__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datafc-1.3.0 → datafc-1.5.0}/PKG-INFO +366 -17
- {datafc-1.3.0 → datafc-1.5.0}/README.md +365 -16
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/__init__.py +7 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_coordinates_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_goal_networks_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_lineups_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_match_data.py +40 -2
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_match_odds_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_match_stats_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_momentum_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_past_matches_data.py +42 -4
- datafc-1.5.0/datafc/sofascore/fetch_player_stats_data.py +132 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_shots_data.py +1 -1
- datafc-1.5.0/datafc/sofascore/fetch_squad_data.py +123 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_standings_data.py +1 -1
- {datafc-1.3.0 → datafc-1.5.0}/datafc/sofascore/fetch_substitutions_data.py +1 -1
- datafc-1.5.0/datafc/sofascore/fetch_team_stats_data.py +114 -0
- datafc-1.5.0/datafc/utils/_config.py +25 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc.egg-info/PKG-INFO +366 -17
- {datafc-1.3.0 → datafc-1.5.0}/datafc.egg-info/SOURCES.txt +3 -0
- {datafc-1.3.0 → datafc-1.5.0}/setup.py +1 -1
- datafc-1.3.0/datafc/utils/_config.py +0 -8
- {datafc-1.3.0 → datafc-1.5.0}/LICENSE +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc/__init__.py +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc/utils/__init__.py +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc/utils/_save_files.py +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc/utils/_setup_webdriver.py +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc.egg-info/dependency_links.txt +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc.egg-info/requires.txt +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/datafc.egg-info/top_level.txt +0 -0
- {datafc-1.3.0 → datafc-1.5.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: datafc
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: A scalable Python library for fetching, processing, and exporting structured football match data.
|
|
5
5
|
Home-page: https://github.com/urazakgul/datafc
|
|
6
6
|
Author: Uraz Akgül
|
|
@@ -14,7 +14,7 @@ Requires-Python: >=3.8
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
|
|
17
|
-
# datafc v1.
|
|
17
|
+
# datafc v1.5.0
|
|
18
18
|
|
|
19
19
|
## Overview
|
|
20
20
|
|
|
@@ -53,7 +53,7 @@ pip install git+https://github.com/urazakgul/datafc.git
|
|
|
53
53
|
To install a specific version of `datafc`, use:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
pip install datafc==1.
|
|
56
|
+
pip install datafc==1.5.0
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
If you already have `datafc` installed and want to upgrade to the latest version, run:
|
|
@@ -111,7 +111,10 @@ from datafc.sofascore import (
|
|
|
111
111
|
substitutions_data,
|
|
112
112
|
goal_networks_data,
|
|
113
113
|
shots_data,
|
|
114
|
-
standings_data
|
|
114
|
+
standings_data,
|
|
115
|
+
team_stats_data,
|
|
116
|
+
player_stats_data,
|
|
117
|
+
squad_data
|
|
115
118
|
)
|
|
116
119
|
```
|
|
117
120
|
|
|
@@ -141,10 +144,22 @@ The `lineups_data` function fetches player lineup details for each match and is
|
|
|
141
144
|
|
|
142
145
|
Without `lineups_data`, these dependent functions will not work as expected.
|
|
143
146
|
|
|
147
|
+
### `standings_data`: A Foundation for Team and Player-Level Functions
|
|
148
|
+
|
|
144
149
|
Exception: `standings_data` and `past_matches_data`
|
|
145
150
|
|
|
146
151
|
Unlike other functions, `standings_data` and `past_matches_data` do not require `match_data` or `lineups_data`. They can be executed independently using only `tournament_id` and `season_id`. Additionally, `past_matches_data` includes an extra field: `week_number`.
|
|
147
152
|
|
|
153
|
+
However, `standings_data` serves as a critical dependency for the following functions:
|
|
154
|
+
|
|
155
|
+
* `team_stats_data`
|
|
156
|
+
* `player_stats_data`
|
|
157
|
+
* `squad_data`
|
|
158
|
+
|
|
159
|
+
These functions rely on team-level metadata (such as `team_id`) provided by `standings_data` to fetch more granular data. Ensure that `standings_data` is successfully executed and includes teams with `category == 'Total'` before calling any of the above functions.
|
|
160
|
+
|
|
161
|
+
`past_matches_data` also works independently and includes an extra field: `week_number`.
|
|
162
|
+
|
|
148
163
|
### Match Data
|
|
149
164
|
|
|
150
165
|
#### `match_data`
|
|
@@ -164,15 +179,52 @@ match_df = match_data(
|
|
|
164
179
|
)
|
|
165
180
|
|
|
166
181
|
print(match_df)
|
|
182
|
+
|
|
183
|
+
uefa_match_df = match_data(
|
|
184
|
+
tournament_id=7,
|
|
185
|
+
season_id=61644,
|
|
186
|
+
week_number=5,
|
|
187
|
+
tournament_type="uefa",
|
|
188
|
+
tournament_stage="round_of_16",
|
|
189
|
+
data_source="sofascore",
|
|
190
|
+
enable_json_export=True,
|
|
191
|
+
enable_excel_export=True
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
print(uefa_match_df)
|
|
167
195
|
```
|
|
168
196
|
|
|
169
197
|
Parameters:
|
|
170
198
|
|
|
171
199
|
* `tournament_id` (int): The unique identifier for the tournament.
|
|
172
200
|
* `season_id` (int): The unique identifier for the season.
|
|
173
|
-
* `week_number` (int): The matchweek number within the season.
|
|
201
|
+
* `week_number` (int): The matchweek number within the season. The applicable week numbers depend on the tournament and stage, as outlined below for the 2024/25 season:
|
|
202
|
+
* UCL, UEL, UECL, and UNL:
|
|
203
|
+
* `qualification_round`: 1, 2, 3
|
|
204
|
+
* `qualification_playoff`: 636
|
|
205
|
+
* `group_stage_week`: 1, 2, 3, ..., 8 (for UNL, up to 6)
|
|
206
|
+
* `playoff_round`: 636
|
|
207
|
+
* `round_of_16`: 5
|
|
208
|
+
* `quarterfinals`: 27
|
|
209
|
+
* `semifinals`: 28
|
|
210
|
+
* `final`: 29
|
|
211
|
+
* Domestic Leagues:
|
|
212
|
+
* Use the corresponding matchweek number (e.g., for the 10th week of the season, enter `week_number=10`).
|
|
213
|
+
* `tournament_type` (str, optional): The tournament type (`uefa`). If `None`, assumes league format.
|
|
214
|
+
* `tournament_stage` (str, optional): The specific stage of the tournament. Available options for UEFA tournaments:
|
|
215
|
+
* `preliminary_final`
|
|
216
|
+
* `preliminary_final`
|
|
217
|
+
* `qualification_round`
|
|
218
|
+
* `qualification_playoff`
|
|
219
|
+
* `group_stage_week`
|
|
220
|
+
* `playoff_round`
|
|
221
|
+
* `round_of_16`
|
|
222
|
+
* `quarterfinals`
|
|
223
|
+
* `semifinals`
|
|
224
|
+
* `match_for_3rd_place`
|
|
225
|
+
* `final`
|
|
174
226
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
175
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
227
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
176
228
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
177
229
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
178
230
|
|
|
@@ -223,13 +275,22 @@ match_odds_df = match_odds_data(
|
|
|
223
275
|
)
|
|
224
276
|
|
|
225
277
|
print(match_odds_df)
|
|
278
|
+
|
|
279
|
+
uefa_match_odds_df = match_odds_data(
|
|
280
|
+
match_df=uefa_match_df,
|
|
281
|
+
data_source="sofascore",
|
|
282
|
+
enable_json_export=True,
|
|
283
|
+
enable_excel_export=True
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
print(uefa_match_odds_df)
|
|
226
287
|
```
|
|
227
288
|
|
|
228
289
|
Parameters:
|
|
229
290
|
|
|
230
291
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
231
292
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
232
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
293
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
233
294
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
234
295
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
235
296
|
|
|
@@ -270,13 +331,22 @@ match_stats_df = match_stats_data(
|
|
|
270
331
|
)
|
|
271
332
|
|
|
272
333
|
print(match_stats_df)
|
|
334
|
+
|
|
335
|
+
uefa_match_stats_df = match_stats_data(
|
|
336
|
+
match_df=uefa_match_df,
|
|
337
|
+
data_source="sofascore",
|
|
338
|
+
enable_json_export=True,
|
|
339
|
+
enable_excel_export=True
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
print(uefa_match_stats_df)
|
|
273
343
|
```
|
|
274
344
|
|
|
275
345
|
Parameters:
|
|
276
346
|
|
|
277
347
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
278
348
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
279
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
349
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
280
350
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
281
351
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
282
352
|
|
|
@@ -314,13 +384,22 @@ momentum_df = momentum_data(
|
|
|
314
384
|
)
|
|
315
385
|
|
|
316
386
|
print(momentum_df)
|
|
387
|
+
|
|
388
|
+
uefa_momentum_df = momentum_data(
|
|
389
|
+
match_df=uefa_match_df,
|
|
390
|
+
data_source="sofascore",
|
|
391
|
+
enable_json_export=True,
|
|
392
|
+
enable_excel_export=True
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
print(uefa_momentum_df)
|
|
317
396
|
```
|
|
318
397
|
|
|
319
398
|
Parameters:
|
|
320
399
|
|
|
321
400
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
322
401
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
323
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
402
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
324
403
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
325
404
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
326
405
|
|
|
@@ -357,15 +436,52 @@ past_matches_df = past_matches_data(
|
|
|
357
436
|
)
|
|
358
437
|
|
|
359
438
|
print(past_matches_df)
|
|
439
|
+
|
|
440
|
+
uefa_past_matches_df = past_matches_data(
|
|
441
|
+
tournament_id=7,
|
|
442
|
+
season_id=61644,
|
|
443
|
+
week_number=5,
|
|
444
|
+
tournament_type="uefa",
|
|
445
|
+
tournament_stage="round_of_16",
|
|
446
|
+
data_source="sofascore",
|
|
447
|
+
enable_json_export=True,
|
|
448
|
+
enable_excel_export=True
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
print(uefa_past_matches_df)
|
|
360
452
|
```
|
|
361
453
|
|
|
362
454
|
Parameters:
|
|
363
455
|
|
|
364
456
|
* `tournament_id` (int): The unique identifier for the tournament.
|
|
365
457
|
* `season_id` (int): The unique identifier for the season.
|
|
366
|
-
* `week_number` (int): The matchweek number within the season.
|
|
458
|
+
* `week_number` (int): The matchweek number within the season. The applicable week numbers depend on the tournament and stage, as outlined below for the 2024/25 season:
|
|
459
|
+
* UCL, UEL, UECL, and UNL:
|
|
460
|
+
* `qualification_round`: 1, 2, 3
|
|
461
|
+
* `qualification_playoff`: 636
|
|
462
|
+
* `group_stage_week`: 1, 2, 3, ..., 8 (for UNL, up to 6)
|
|
463
|
+
* `playoff_round`: 636
|
|
464
|
+
* `round_of_16`: 5
|
|
465
|
+
* `quarterfinals`: 27
|
|
466
|
+
* `semifinals`: 28
|
|
467
|
+
* `final`: 29
|
|
468
|
+
* Domestic Leagues:
|
|
469
|
+
* Use the corresponding matchweek number (e.g., for the 10th week of the season, enter `week_number=10`).
|
|
470
|
+
* `tournament_type` (str, optional): The tournament type (`uefa`). If `None`, assumes league format.
|
|
471
|
+
* `tournament_stage` (str, optional): The specific stage of the tournament. Available options for UEFA tournaments:
|
|
472
|
+
* `preliminary_final`
|
|
473
|
+
* `preliminary_final`
|
|
474
|
+
* `qualification_round`
|
|
475
|
+
* `qualification_playoff`
|
|
476
|
+
* `group_stage_week`
|
|
477
|
+
* `playoff_round`
|
|
478
|
+
* `round_of_16`
|
|
479
|
+
* `quarterfinals`
|
|
480
|
+
* `semifinals`
|
|
481
|
+
* `match_for_3rd_place`
|
|
482
|
+
* `final`
|
|
367
483
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
368
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
484
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
369
485
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
370
486
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
371
487
|
|
|
@@ -418,13 +534,22 @@ lineups_df = lineups_data(
|
|
|
418
534
|
)
|
|
419
535
|
|
|
420
536
|
print(lineups_df)
|
|
537
|
+
|
|
538
|
+
uefa_lineups_df = lineups_data(
|
|
539
|
+
match_df=uefa_match_df,
|
|
540
|
+
data_source="sofascore",
|
|
541
|
+
enable_json_export=True,
|
|
542
|
+
enable_excel_export=True
|
|
543
|
+
)
|
|
544
|
+
|
|
545
|
+
print(uefa_lineups_df)
|
|
421
546
|
```
|
|
422
547
|
|
|
423
548
|
Parameters:
|
|
424
549
|
|
|
425
550
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
426
551
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
427
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
552
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
428
553
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
429
554
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
430
555
|
|
|
@@ -462,13 +587,22 @@ coordinates_df = coordinates_data(
|
|
|
462
587
|
)
|
|
463
588
|
|
|
464
589
|
print(coordinates_df)
|
|
590
|
+
|
|
591
|
+
uefa_coordinates_df = coordinates_data(
|
|
592
|
+
lineups_df=uefa_lineups_df,
|
|
593
|
+
data_source="sofascore",
|
|
594
|
+
enable_json_export=True,
|
|
595
|
+
enable_excel_export=True
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
print(uefa_coordinates_df)
|
|
465
599
|
```
|
|
466
600
|
|
|
467
601
|
Parameters:
|
|
468
602
|
|
|
469
603
|
* `lineups_df` (pd.DataFrame): A DataFrame containing player and match metadata, which should be generated by the `lineups_data` function.
|
|
470
604
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
471
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
605
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
472
606
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
473
607
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
474
608
|
|
|
@@ -506,13 +640,22 @@ substitutions_df = substitutions_data(
|
|
|
506
640
|
)
|
|
507
641
|
|
|
508
642
|
print(substitutions_df)
|
|
643
|
+
|
|
644
|
+
uefa_substitutions_df = substitutions_data(
|
|
645
|
+
match_df=uefa_match_df,
|
|
646
|
+
data_source="sofascore",
|
|
647
|
+
enable_json_export=True,
|
|
648
|
+
enable_excel_export=True
|
|
649
|
+
)
|
|
650
|
+
|
|
651
|
+
print(uefa_substitutions_df)
|
|
509
652
|
```
|
|
510
653
|
|
|
511
654
|
Parameters:
|
|
512
655
|
|
|
513
656
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
514
657
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
515
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
658
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
516
659
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
517
660
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
518
661
|
|
|
@@ -552,13 +695,22 @@ goal_networks_df = goal_networks_data(
|
|
|
552
695
|
)
|
|
553
696
|
|
|
554
697
|
print(goal_networks_df)
|
|
698
|
+
|
|
699
|
+
uefa_goal_networks_df = goal_networks_data(
|
|
700
|
+
match_df=uefa_match_df,
|
|
701
|
+
data_source="sofascore",
|
|
702
|
+
enable_json_export=True,
|
|
703
|
+
enable_excel_export=True
|
|
704
|
+
)
|
|
705
|
+
|
|
706
|
+
print(uefa_goal_networks_df)
|
|
555
707
|
```
|
|
556
708
|
|
|
557
709
|
Parameters:
|
|
558
710
|
|
|
559
711
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
560
712
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
561
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
713
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
562
714
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
563
715
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
564
716
|
|
|
@@ -608,13 +760,22 @@ shots_df = shots_data(
|
|
|
608
760
|
)
|
|
609
761
|
|
|
610
762
|
print(shots_df)
|
|
763
|
+
|
|
764
|
+
uefa_shots_df = shots_data(
|
|
765
|
+
match_df=uefa_match_df,
|
|
766
|
+
data_source="sofascore",
|
|
767
|
+
enable_json_export=True,
|
|
768
|
+
enable_excel_export=True
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
print(uefa_shots_df)
|
|
611
772
|
```
|
|
612
773
|
|
|
613
774
|
Parameters:
|
|
614
775
|
|
|
615
776
|
* `match_df` (pd.DataFrame): A DataFrame containing match metadata, which should be generated by the `match_data` function.
|
|
616
777
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
617
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
778
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
618
779
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
619
780
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
620
781
|
|
|
@@ -675,6 +836,16 @@ standings_df = standings_data(
|
|
|
675
836
|
)
|
|
676
837
|
|
|
677
838
|
print(standings_df)
|
|
839
|
+
|
|
840
|
+
uefa_standings_df = standings_data(
|
|
841
|
+
tournament_id=7,
|
|
842
|
+
season_id=61644,
|
|
843
|
+
data_source="sofascore",
|
|
844
|
+
enable_json_export=True,
|
|
845
|
+
enable_excel_export=True
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
print(uefa_standings_df)
|
|
678
849
|
```
|
|
679
850
|
|
|
680
851
|
Parameters:
|
|
@@ -682,7 +853,7 @@ Parameters:
|
|
|
682
853
|
* `tournament_id` (int): The unique identifier for the tournament.
|
|
683
854
|
* `season_id` (int): The unique identifier for the season.
|
|
684
855
|
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `sofascore`.
|
|
685
|
-
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to 10
|
|
856
|
+
* `element_load_timeout` (int): The maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
686
857
|
* `enable_json_export` (bool): If `True`, exports the fetched data as a JSON file. Defaults to `False`.
|
|
687
858
|
* `enable_excel_export` (bool): If `True`, exports the fetched data as an Excel file. Defaults to `False`.
|
|
688
859
|
|
|
@@ -708,8 +879,186 @@ Dependencies:
|
|
|
708
879
|
|
|
709
880
|
* No prior function dependency required.
|
|
710
881
|
|
|
882
|
+
### Team Statistics Data
|
|
883
|
+
|
|
884
|
+
#### `team_stats_data`
|
|
885
|
+
|
|
886
|
+
The `team_stats_data` function fetches detailed statistical data for each team in a given tournament and season, based on the team list provided by `standings_data`.
|
|
887
|
+
|
|
888
|
+
Note: This function requires the output of `standings_data` and only processes rows where `category == 'Total'`.
|
|
889
|
+
|
|
890
|
+
Example Usage:
|
|
891
|
+
|
|
892
|
+
```python
|
|
893
|
+
standings_df = standings_data(
|
|
894
|
+
tournament_id=52,
|
|
895
|
+
season_id=63814,
|
|
896
|
+
data_source="sofascore"
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
team_stats_df = team_stats_data(
|
|
900
|
+
standings_df=standings_df,
|
|
901
|
+
tournament_id=52,
|
|
902
|
+
season_id=63814,
|
|
903
|
+
data_source="sofascore",
|
|
904
|
+
enable_json_export=True,
|
|
905
|
+
enable_excel_export=True
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
print(team_stats_df)
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
Parameters:
|
|
912
|
+
|
|
913
|
+
* `standings_df` (pd.DataFrame): A DataFrame with metadata on each team, typically returned by standings_data.
|
|
914
|
+
* `tournament_id` (int): The unique identifier for the tournament.
|
|
915
|
+
* `season_id` (int): The unique identifier for the season.
|
|
916
|
+
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `"sofascore"`.
|
|
917
|
+
* `element_load_timeout` (int): Maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
918
|
+
* `enable_json_export` (bool): If `True`, exports the data as a JSON file. Defaults to `False`.
|
|
919
|
+
* `enable_excel_export` (bool): If `True`, exports the data as an Excel file. Defaults to `False`.
|
|
920
|
+
|
|
921
|
+
Data Structure:
|
|
922
|
+
|
|
923
|
+
The returned DataFrame includes the following columns:
|
|
924
|
+
|
|
925
|
+
* `country`: The country where the tournament is held.
|
|
926
|
+
* `tournament`: The name of the tournament.
|
|
927
|
+
* `team_name`: The name of the team.
|
|
928
|
+
* `team_id`: The unique identifier of the team.
|
|
929
|
+
* `stat`: The name of the statistic.
|
|
930
|
+
* `value`: The value of the statistic.
|
|
931
|
+
|
|
932
|
+
Dependencies:
|
|
933
|
+
|
|
934
|
+
* Requires `standings_data` output as `standings_df`.
|
|
935
|
+
|
|
936
|
+
### Player Statistics Data
|
|
937
|
+
|
|
938
|
+
#### `player_stats_data`
|
|
939
|
+
|
|
940
|
+
The `player_stats_data` function fetches top player statistics for each team in the given standings dataset. It processes player-level metrics like goals, assists, duels won, and more.
|
|
941
|
+
|
|
942
|
+
Note: This function requires the output of `standings_data`, and filters for rows where `category == 'Total'`.
|
|
943
|
+
|
|
944
|
+
Example Usage:
|
|
945
|
+
|
|
946
|
+
```python
|
|
947
|
+
standings_df = standings_data(
|
|
948
|
+
tournament_id=52,
|
|
949
|
+
season_id=63814,
|
|
950
|
+
data_source="sofascore"
|
|
951
|
+
)
|
|
952
|
+
|
|
953
|
+
player_stats_df = player_stats_data(
|
|
954
|
+
standings_df=standings_df,
|
|
955
|
+
tournament_id=52,
|
|
956
|
+
season_id=63814,
|
|
957
|
+
data_source="sofascore",
|
|
958
|
+
enable_json_export=True,
|
|
959
|
+
enable_excel_export=True
|
|
960
|
+
)
|
|
961
|
+
|
|
962
|
+
print(player_stats_df)
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
Parameters:
|
|
966
|
+
|
|
967
|
+
* `standings_df` (pd.DataFrame): A DataFrame with metadata on teams, returned by standings_data.
|
|
968
|
+
* `tournament_id` (int): The unique identifier for the tournament.
|
|
969
|
+
* `season_id` (int): The unique identifier for the season.
|
|
970
|
+
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `"sofascore"`.
|
|
971
|
+
* `element_load_timeout` (int): Maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
972
|
+
* `enable_json_export` (bool): If `True`, exports the data as a JSON file. Defaults to `False`.
|
|
973
|
+
* `enable_excel_export` (bool): If `True`, exports the data as an Excel file. Defaults to `False`.
|
|
974
|
+
|
|
975
|
+
Data Structure:
|
|
976
|
+
|
|
977
|
+
The returned DataFrame includes the following columns:
|
|
978
|
+
|
|
979
|
+
* `country`: The country where the tournament is held.
|
|
980
|
+
* `tournament`: The name of the tournament.
|
|
981
|
+
* `team_name`: The name of the team.
|
|
982
|
+
* `team_id`: The unique identifier of the team.
|
|
983
|
+
* `player_name`: The name of the player.
|
|
984
|
+
* `player_id`: The unique identifier of the player.
|
|
985
|
+
* `position`: The player’s position.
|
|
986
|
+
* `stat_name`: The name of the statistic.
|
|
987
|
+
* `stat_value`: The value of the statistic.
|
|
988
|
+
|
|
989
|
+
Dependencies:
|
|
990
|
+
|
|
991
|
+
* Requires `standings_data` output as `standings_df`.
|
|
992
|
+
|
|
993
|
+
### Squad Data
|
|
994
|
+
|
|
995
|
+
#### `squad_data`
|
|
996
|
+
|
|
997
|
+
The `squad_data` function fetches detailed squad (roster) information for each team listed in the provided standings dataset. It includes player bio data such as age, height, position, market value, and contract info.
|
|
998
|
+
|
|
999
|
+
Note: This function requires the output of `standings_data`, and only processes rows where `category == 'Total'`.
|
|
1000
|
+
|
|
1001
|
+
Example Usage:
|
|
1002
|
+
|
|
1003
|
+
```python
|
|
1004
|
+
standings_df = standings_data(
|
|
1005
|
+
tournament_id=52,
|
|
1006
|
+
season_id=63814,
|
|
1007
|
+
data_source="sofascore"
|
|
1008
|
+
)
|
|
1009
|
+
|
|
1010
|
+
squad_df = squad_data(
|
|
1011
|
+
standings_df=standings_df,
|
|
1012
|
+
data_source="sofascore",
|
|
1013
|
+
enable_json_export=True,
|
|
1014
|
+
enable_excel_export=True
|
|
1015
|
+
)
|
|
1016
|
+
|
|
1017
|
+
print(squad_df)
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
Parameters:
|
|
1021
|
+
|
|
1022
|
+
* `standings_df` (pd.DataFrame): A DataFrame with team metadata, returned by standings_data.
|
|
1023
|
+
* `data_source` (str): The data source (`sofavpn` or `sofascore`). Defaults to `"sofascore"`.
|
|
1024
|
+
* `element_load_timeout` (int): Maximum time (in seconds) to wait for the API response. Defaults to `10`.
|
|
1025
|
+
* `enable_json_export` (bool): If `True`, exports the data as a JSON file. Defaults to `False`.
|
|
1026
|
+
* `enable_excel_export` (bool): If `True`, exports the data as an Excel file. Defaults to `False`.
|
|
1027
|
+
|
|
1028
|
+
Data Structure:
|
|
1029
|
+
|
|
1030
|
+
The returned DataFrame includes the following columns:
|
|
1031
|
+
|
|
1032
|
+
* `country`: The country where the tournament is held.
|
|
1033
|
+
* `tournament`: The name of the tournament.
|
|
1034
|
+
* `team_name`: The name of the team.
|
|
1035
|
+
* `team_id`: The unique identifier of the team.
|
|
1036
|
+
* `player_name`: The name of the player.
|
|
1037
|
+
* `player_id`: The unique identifier of the player.
|
|
1038
|
+
* `age`: The date of birth timestamp (UNIX format).
|
|
1039
|
+
* `height`: The height of the player.
|
|
1040
|
+
* `player_country`: The nationality of the player.
|
|
1041
|
+
* `position`: The position of the player.
|
|
1042
|
+
* `preferred_foot`: The preferred foot of the player.
|
|
1043
|
+
* `contract_until`: The contract end date (UNIX timestamp).
|
|
1044
|
+
* `market_value`: The market value of the player.
|
|
1045
|
+
* `market_currency`: The currency used for the market value.
|
|
1046
|
+
|
|
1047
|
+
Dependencies:
|
|
1048
|
+
|
|
1049
|
+
* Requires `standings_data` output as `standings_df`.
|
|
1050
|
+
|
|
711
1051
|
## Changelog
|
|
712
1052
|
|
|
1053
|
+
* v1.5.0
|
|
1054
|
+
* Added `team_stats_data` function to retrieve detailed per-team statistics using `standings_data`.
|
|
1055
|
+
* Added `player_stats_data` function to retrieve player-level top stats per team.
|
|
1056
|
+
* Added `squad_data` function to fetch full squad information including bio and market value.
|
|
1057
|
+
|
|
1058
|
+
* v1.4.0
|
|
1059
|
+
* Added `tournament_type` and `tournament_stage` parameters to `match_data` and `past_matches_data` functions.
|
|
1060
|
+
* Extended support for UEFA tournaments, including UEFA Champions League (UCL), UEFA Europa League (UEL), UEFA Europa Conference League (UECL), and UEFA Nations League (UNL), allowing seamless data fetching across multiple competitions.
|
|
1061
|
+
|
|
713
1062
|
* v1.3.0
|
|
714
1063
|
* Added `past_matches_data` function to fetch historical match data.
|
|
715
1064
|
|