Datasets:
Upload anneal.py
Browse files
anneal.py
CHANGED
@@ -148,11 +148,11 @@ class Anneal(datasets.GeneratorBasedBuilder):
|
|
148 |
|
149 |
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
150 |
data.columns = _BASE_FEATURE_NAMES
|
151 |
-
data = data[data.formability != "?"]
|
152 |
-
data = data[data.enamelability != "?"]
|
153 |
|
154 |
-
data.loc[:, "formability"] = data.formability.apply(lambda x: int(x) if x
|
155 |
-
data.loc[:, "enamelability"] = data.enamelability.apply(lambda x: int(x) if x
|
156 |
data.loc[:, "non_ageing"] = data.formability.apply(lambda x: True if x == "-" else False)
|
157 |
data.loc[:, "bc"] = data.bc.apply(lambda x: True if x == "Y" else False)
|
158 |
data.loc[:, "bf"] = data.bf.apply(lambda x: True if x == "Y" else False)
|
|
|
148 |
|
149 |
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
150 |
data.columns = _BASE_FEATURE_NAMES
|
151 |
+
# data = data[data.formability != "?"]
|
152 |
+
# data = data[data.enamelability != "?"]
|
153 |
|
154 |
+
data.loc[:, "formability"] = data.formability.apply(lambda x: int(x) if x not in ("?", "-") else 0)
|
155 |
+
data.loc[:, "enamelability"] = data.enamelability.apply(lambda x: int(x) if x not in ("?", "-") else 0)
|
156 |
data.loc[:, "non_ageing"] = data.formability.apply(lambda x: True if x == "-" else False)
|
157 |
data.loc[:, "bc"] = data.bc.apply(lambda x: True if x == "Y" else False)
|
158 |
data.loc[:, "bf"] = data.bf.apply(lambda x: True if x == "Y" else False)
|