iszhaoxin commited on
Commit
0c85679
·
verified ·
1 Parent(s): 05fbeb6

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
- version=datasets.Version("1.0.0"),
27
- description="This is subset A"),
28
- datasets.BuilderConfig(
29
- name="products",
30
- version=datasets.Version("1.0.0"),
31
- description="This is subset B"),
32
- ]
33
-
34
- def _info(self):
35
- # set_trace()
36
- if self.config.name == "customers":
37
- features = datasets.Features(
38
- {
39
- "customer_id": datasets.Value("int64"),
40
- "name": datasets.Value("string"),
41
- "age": datasets.Value("int64"),
42
- }
43
- )
44
- elif self.config.name == "products":
45
- features = datasets.Features(
46
- {
47
- "product_id": datasets.Value("int64"),
48
- "name": datasets.Value("string"),
49
- "price": datasets.Value("double"),
50
- }
51
- )
52
- else:
53
- raise ValueError(f"Unknown subset: {self.config.name}")
54
-
55
- return datasets.DatasetInfo(
56
- description=_DESCRIPTION,
57
- features=features,
58
- supervised_keys=None,
59
- homepage=_HOMEPAGE,
60
- license=_LICENSE,
61
- citation=_CITATION,
62
- )
63
-
64
- def _split_generators(self, dl_manager):
65
- data_dir = dl_manager.manual_dir or "./"
66
- data_dir = os.path.join(data_dir, self.config.name)
67
- return [
68
- datasets.SplitGenerator(
69
- name=datasets.Split.TRAIN,
70
- gen_kwargs={"filepath": os.path.join(data_dir, "train.csv")},
71
- ),
72
- datasets.SplitGenerator(
73
- name=datasets.Split.VALIDATION,
74
- gen_kwargs={"filepath": os.path.join(data_dir, "val.csv")},
75
- ),
76
- datasets.SplitGenerator(
77
- name=datasets.Split.TEST,
78
- gen_kwargs={"filepath": os.path.join(data_dir, "test.csv")},
79
- ),
80
- ]
81
-
82
- def _generate_examples(self, filepath):
83
- # set_trace()
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()