Spaces:
Sleeping
Sleeping
Upload environment.py with huggingface_hub
Browse files- environment.py +4 -1
environment.py
CHANGED
|
@@ -219,7 +219,10 @@ class DataCleaningEnv:
|
|
| 219 |
fill_val = numeric.median()
|
| 220 |
self.current_df[c] = numeric.fillna(fill_val)
|
| 221 |
elif strategy == "mode":
|
| 222 |
-
|
|
|
|
|
|
|
|
|
|
| 223 |
self.current_df[c] = self.current_df[c].fillna(fill_val)
|
| 224 |
elif strategy == "ffill":
|
| 225 |
self.current_df[c] = self.current_df[c].ffill()
|
|
|
|
| 219 |
fill_val = numeric.median()
|
| 220 |
self.current_df[c] = numeric.fillna(fill_val)
|
| 221 |
elif strategy == "mode":
|
| 222 |
+
mode_vals = self.current_df[c].mode()
|
| 223 |
+
if len(mode_vals) == 0:
|
| 224 |
+
continue
|
| 225 |
+
fill_val = mode_vals.iloc[0]
|
| 226 |
self.current_df[c] = self.current_df[c].fillna(fill_val)
|
| 227 |
elif strategy == "ffill":
|
| 228 |
self.current_df[c] = self.current_df[c].ffill()
|