Datasets:
Update adult.py
Browse files
adult.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
"""Adult: A Census Dataset"""
|
2 |
-
|
3 |
from typing import List
|
4 |
from functools import partial
|
5 |
|
@@ -32,7 +30,7 @@ _BASE_FEATURE_NAMES = [
|
|
32 |
"capital_loss",
|
33 |
"education",
|
34 |
"final_weight",
|
35 |
-
"
|
36 |
"marital_status",
|
37 |
"native_country",
|
38 |
"occupation",
|
@@ -212,18 +210,9 @@ class Adult(datasets.GeneratorBasedBuilder):
|
|
212 |
yield row_id, data_row
|
213 |
|
214 |
def encodings(self):
|
215 |
-
data =
|
216 |
-
|
217 |
-
|
218 |
-
for feature, d in _ENCODING_DICS.items()]
|
219 |
-
data.append(pandas.DataFrame([("race", original_value, encoded_value)
|
220 |
-
for original_value, encoded_value in _RACE_ENCODING.items()],
|
221 |
-
columns=["feature", "original_value", "encoded_value"]))
|
222 |
-
data.append(pandas.DataFrame([("education", original_value, encoded_value)
|
223 |
-
for original_value, encoded_value in _EDUCATION_ENCODING.items()],
|
224 |
-
columns=["feature", "original_value", "encoded_value"]))
|
225 |
-
data = pandas.concat(data, axis="rows").reset_index()
|
226 |
-
data.drop("index", axis="columns", inplace=True)
|
227 |
|
228 |
return data
|
229 |
|
|
|
|
|
|
|
1 |
from typing import List
|
2 |
from functools import partial
|
3 |
|
|
|
30 |
"capital_loss",
|
31 |
"education",
|
32 |
"final_weight",
|
33 |
+
"hours_worked_per_week",
|
34 |
"marital_status",
|
35 |
"native_country",
|
36 |
"occupation",
|
|
|
210 |
yield row_id, data_row
|
211 |
|
212 |
def encodings(self):
|
213 |
+
data = pandas.DataFrame([("education", original_value, encoded_value)
|
214 |
+
for original_value, encoded_value in _EDUCATION_ENCODING.items()],
|
215 |
+
columns=["feature", "original_value", "encoded_value"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
return data
|
218 |
|