Datasets:
Upload monks.py
Browse files
monks.py
CHANGED
@@ -10,6 +10,7 @@ import pandas
|
|
10 |
|
11 |
VERSION = datasets.Version("1.0.0")
|
12 |
_ORIGINAL_FEATURE_NAMES = [
|
|
|
13 |
"is_monk",
|
14 |
"head_shape",
|
15 |
"body_shape",
|
@@ -165,11 +166,12 @@ class Monk(datasets.GeneratorBasedBuilder):
|
|
165 |
|
166 |
def preprocess(self, data: pandas.DataFrame, config: str = "monks1") -> pandas.DataFrame:
|
167 |
print(data.head())
|
168 |
-
data.columns =
|
169 |
data.drop("ID", axis="columns", inplace=True)
|
170 |
data.drop("empty", axis="columns", inplace=True)
|
171 |
data.loc[:, "has_tie"] = data.has_tie.apply(bool)
|
172 |
data.loc[:, "is_smiling"] = data.is_smiling.apply(bool)
|
|
|
173 |
|
174 |
for feature in _ENCODING_DICS:
|
175 |
encoding_function = partial(self.encode, feature)
|
|
|
10 |
|
11 |
VERSION = datasets.Version("1.0.0")
|
12 |
_ORIGINAL_FEATURE_NAMES = [
|
13 |
+
"empty",
|
14 |
"is_monk",
|
15 |
"head_shape",
|
16 |
"body_shape",
|
|
|
166 |
|
167 |
def preprocess(self, data: pandas.DataFrame, config: str = "monks1") -> pandas.DataFrame:
|
168 |
print(data.head())
|
169 |
+
data.columns = _ORIGINAL_FEATURE_NAMES
|
170 |
data.drop("ID", axis="columns", inplace=True)
|
171 |
data.drop("empty", axis="columns", inplace=True)
|
172 |
data.loc[:, "has_tie"] = data.has_tie.apply(bool)
|
173 |
data.loc[:, "is_smiling"] = data.is_smiling.apply(bool)
|
174 |
+
data.columns = _BASE_FEATURE_NAMES
|
175 |
|
176 |
for feature in _ENCODING_DICS:
|
177 |
encoding_function = partial(self.encode, feature)
|