Datasets:
Upload bank.py
Browse files
bank.py
CHANGED
@@ -113,8 +113,13 @@ class Bank(datasets.GeneratorBasedBuilder):
|
|
113 |
]
|
114 |
|
115 |
def _generate_examples(self, filepath: str):
|
|
|
|
|
|
|
116 |
data = pandas.read_csv(filepath, sep=";")
|
|
|
117 |
data = self.preprocess(data, config=self.config.name)
|
|
|
118 |
|
119 |
for row_id, row in data.iterrows():
|
120 |
data_row = dict(row)
|
@@ -135,9 +140,7 @@ class Bank(datasets.GeneratorBasedBuilder):
|
|
135 |
data.loc[:, "housing"] = data.housing.apply(self.encode_yes_no)
|
136 |
data.loc[:, "default"] = data.default.apply(self.encode_yes_no)
|
137 |
|
138 |
-
if config == "
|
139 |
-
return self.encoding_dictionaries()
|
140 |
-
elif config == "subscription":
|
141 |
return data
|
142 |
else:
|
143 |
raise ValueError(f"Unknown config: {config}")
|
|
|
113 |
]
|
114 |
|
115 |
def _generate_examples(self, filepath: str):
|
116 |
+
if self.config_name == "encoding":
|
117 |
+
return self.encoding_dictionaries()
|
118 |
+
|
119 |
data = pandas.read_csv(filepath, sep=";")
|
120 |
+
print(f"read dataset w/ {data.shape} shape")
|
121 |
data = self.preprocess(data, config=self.config.name)
|
122 |
+
print(f"now got dataset w/ {data.shape} shape")
|
123 |
|
124 |
for row_id, row in data.iterrows():
|
125 |
data_row = dict(row)
|
|
|
140 |
data.loc[:, "housing"] = data.housing.apply(self.encode_yes_no)
|
141 |
data.loc[:, "default"] = data.default.apply(self.encode_yes_no)
|
142 |
|
143 |
+
if config == "subscription":
|
|
|
|
|
144 |
return data
|
145 |
else:
|
146 |
raise ValueError(f"Unknown config: {config}")
|