iszhaoxin commited on
Commit
b608713
·
verified ·
1 Parent(s): d43287f

Delete loading script

Browse files
Files changed (1) hide show
  1. test.py +0 -87
test.py DELETED
@@ -1,87 +0,0 @@
1
- import os
2
- from pdb import set_trace
3
-
4
- import datasets
5
- import pandas as pd
6
-
7
- _CITATION = """\
8
- Put your dataset citation here.
9
- """
10
-
11
- _DESCRIPTION = """\
12
- Description of your dataset goes here.
13
- """
14
-
15
- _HOMEPAGE = "https://your-dataset-homepage.com"
16
-
17
- _LICENSE = "License information goes here."
18
-
19
-
20
- class Test(datasets.GeneratorBasedBuilder):
21
- """Your dataset description"""
22
-
23
- BUILDER_CONFIGS = [
24
- datasets.BuilderConfig(
25
- name="customers",
26
- data_dir="./",
27
- version=datasets.Version("1.0.0"),
28
- description="This is subset A"),
29
- datasets.BuilderConfig(
30
- name="products",
31
- data_dir="./",
32
- version=datasets.Version("1.0.0"),
33
- description="This is subset B"),
34
- ]
35
-
36
- def _info(self):
37
- # set_trace()
38
- if self.config.name == "customers":
39
- features = datasets.Features(
40
- {
41
- "customer_id": datasets.Value("int64"),
42
- "name": datasets.Value("string"),
43
- "age": datasets.Value("int64"),
44
- }
45
- )
46
- elif self.config.name == "products":
47
- features = datasets.Features(
48
- {
49
- "product_id": datasets.Value("int64"),
50
- "name": datasets.Value("string"),
51
- "price": datasets.Value("double"),
52
- }
53
- )
54
- else:
55
- raise ValueError(f"Unknown subset: {self.config.name}")
56
-
57
- return datasets.DatasetInfo(
58
- description=_DESCRIPTION,
59
- features=features,
60
- supervised_keys=None,
61
- homepage=_HOMEPAGE,
62
- license=_LICENSE,
63
- citation=_CITATION,
64
- )
65
-
66
- def _split_generators(self, dl_manager):
67
- data_dir = os.path.join(self.config.data_dir, self.config.name)
68
- return [
69
- datasets.SplitGenerator(
70
- name=datasets.Split.TRAIN,
71
- gen_kwargs={"filepath": os.path.join(data_dir, "train.csv")},
72
- ),
73
- datasets.SplitGenerator(
74
- name=datasets.Split.VALIDATION,
75
- gen_kwargs={"filepath": os.path.join(data_dir, "val.csv")},
76
- ),
77
- datasets.SplitGenerator(
78
- name=datasets.Split.TEST,
79
- gen_kwargs={"filepath": os.path.join(data_dir, "test.csv")},
80
- ),
81
- ]
82
-
83
- def _generate_examples(self, filepath):
84
- with open(filepath, encoding="utf-8") as f:
85
- df = pd.read_csv(filepath, index_col=0)
86
- for id_, item in df.iterrows():
87
- yield id_, item.to_dict()