iszhaoxin commited on
Commit
17f1ea3
·
verified ·
1 Parent(s): 542c20e

Delete loading script

Browse files
Files changed (1) hide show
  1. test.py +0 -89
test.py DELETED
@@ -1,89 +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("int32"),
42
- "name": datasets.Value("string"),
43
- "age": datasets.Value("int32"),
44
- }
45
- )
46
- elif self.config.name == "products":
47
- features = datasets.Features(
48
- {
49
- "product_id": datasets.Value("int32"),
50
- "name": datasets.Value("string"),
51
- "price": datasets.Value("float32"),
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
- # set_trace()
69
- return [
70
- datasets.SplitGenerator(
71
- name=datasets.Split.TRAIN,
72
- gen_kwargs={"filepath": os.path.join(data_dir, "train.csv")},
73
- ),
74
- datasets.SplitGenerator(
75
- name=datasets.Split.VALIDATION,
76
- gen_kwargs={"filepath": os.path.join(data_dir, "val.csv")},
77
- ),
78
- datasets.SplitGenerator(
79
- name=datasets.Split.TEST,
80
- gen_kwargs={"filepath": os.path.join(data_dir, "test.csv")},
81
- ),
82
- ]
83
-
84
- def _generate_examples(self, filepath):
85
- with open(filepath, encoding="utf-8") as f:
86
- df = pd.read_csv(filepath, index_col=0)
87
- for id_, item in df.iterrows():
88
- # set_trace()
89
- yield id_, item.to_dict()