Update car.py
Browse files
car.py
CHANGED
|
@@ -147,14 +147,14 @@ class Car(datasets.GeneratorBasedBuilder):
|
|
| 147 |
|
| 148 |
yield row_id, data_row
|
| 149 |
|
| 150 |
-
def preprocess(self, data: pandas.DataFrame
|
| 151 |
data.columns = _BASE_FEATURE_NAMES
|
| 152 |
|
| 153 |
for feature in _ENCODING_DICS:
|
| 154 |
encoding_function = partial(self.encode, feature)
|
| 155 |
data[feature] = data[feature].apply(encoding_function)
|
| 156 |
|
| 157 |
-
if config == "car_binary":
|
| 158 |
data["acceptability_level"] = data["acceptability_level"].apply(lambda x: 0 if x == 0 else 1)
|
| 159 |
print("mapping...\n\n")
|
| 160 |
|
|
|
|
| 147 |
|
| 148 |
yield row_id, data_row
|
| 149 |
|
| 150 |
+
def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
|
| 151 |
data.columns = _BASE_FEATURE_NAMES
|
| 152 |
|
| 153 |
for feature in _ENCODING_DICS:
|
| 154 |
encoding_function = partial(self.encode, feature)
|
| 155 |
data[feature] = data[feature].apply(encoding_function)
|
| 156 |
|
| 157 |
+
if self.config.name == "car_binary":
|
| 158 |
data["acceptability_level"] = data["acceptability_level"].apply(lambda x: 0 if x == 0 else 1)
|
| 159 |
print("mapping...\n\n")
|
| 160 |
|