ForzaJuve1
commited on
Commit
•
ab18d14
1
Parent(s):
7476205
Update Integration
Browse files- Integration +53 -0
Integration
CHANGED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datasets import DatasetBuilder, DatasetInfo, Features, Value, SplitGenerator
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
class Euro2020Dataset(DatasetBuilder):
|
5 |
+
VERSION = "1.0.0" # Change as needed
|
6 |
+
BUILDER_CONFIGS = ["euro2020"] # Not strictly necessary but useful for multiple datasets
|
7 |
+
|
8 |
+
def _info(self):
|
9 |
+
return DatasetInfo(
|
10 |
+
description="Your dataset description here.",
|
11 |
+
features=Features({
|
12 |
+
"PlayerID": Value("int32"),
|
13 |
+
"PlayerName": Value("string"),
|
14 |
+
"PlayerSurname": Value("string"),
|
15 |
+
"IsGoalkeeper": Value("bool"),
|
16 |
+
"PlayedTime": Value("int32"),
|
17 |
+
"StatsID": Value("int32"),
|
18 |
+
"StatsName": Value("string"),
|
19 |
+
"Value": Value("string"), # Adjust according to actual content type
|
20 |
+
"Rank": Value("int32"),
|
21 |
+
# Add or remove columns as needed
|
22 |
+
}),
|
23 |
+
supervised_keys=None,
|
24 |
+
homepage="Optional dataset homepage",
|
25 |
+
citation="Optional citation",
|
26 |
+
)
|
27 |
+
|
28 |
+
def _split_generators(self, dl_manager):
|
29 |
+
# Here you define how the data should be split (train, test, validation, etc.)
|
30 |
+
# Since you have a single CSV file, let's assume a single 'train' split for simplicity
|
31 |
+
return [
|
32 |
+
SplitGenerator(
|
33 |
+
name="train",
|
34 |
+
gen_kwargs={"filepath": "path/to/your/euro2020.csv"}
|
35 |
+
),
|
36 |
+
]
|
37 |
+
|
38 |
+
def _generate_examples(self, filepath):
|
39 |
+
# Here we read the CSV file and yield examples
|
40 |
+
data = pd.read_csv(filepath)
|
41 |
+
for idx, row in data.iterrows():
|
42 |
+
yield idx, {
|
43 |
+
"PlayerID": row["PlayerID"],
|
44 |
+
"PlayerName": row["PlayerName"],
|
45 |
+
"PlayerSurname": row["PlayerSurname"],
|
46 |
+
"IsGoalkeeper": row["IsGoalkeeper"],
|
47 |
+
"PlayedTime": row["PlayedTime"],
|
48 |
+
"StatsID": row["StatsID"],
|
49 |
+
"StatsName": row["StatsName"],
|
50 |
+
"Value": row["Value"],
|
51 |
+
"Rank": row["Rank"],
|
52 |
+
# Make sure to include all fields defined in _info
|
53 |
+
}
|