Datasets:
Update compas.py
Browse files
compas.py
CHANGED
@@ -294,14 +294,14 @@ class Compas(datasets.GeneratorBasedBuilder):
|
|
294 |
|
295 |
# handle nan values
|
296 |
data.loc[data.days_b_screening_arrest.isna(), "days_b_screening_arrest"] = -1
|
297 |
-
data
|
298 |
|
299 |
# transform columns into intervals
|
300 |
data = data[(~data.in_custody.isna()) & (~data.out_custody.isna())]
|
301 |
in_dates = data.in_custody.apply(datetime.date.fromisoformat)
|
302 |
out_dates = data.out_custody.apply(datetime.date.fromisoformat)
|
303 |
days_in_custody = [delta.days for delta in out_dates - in_dates]
|
304 |
-
data
|
305 |
data.drop("in_custody", axis="columns", inplace=True)
|
306 |
data.drop("out_custody", axis="columns", inplace=True)
|
307 |
|
|
|
294 |
|
295 |
# handle nan values
|
296 |
data.loc[data.days_b_screening_arrest.isna(), "days_b_screening_arrest"] = -1
|
297 |
+
data["days_b_screening_arrest"] = data.days_b_screening_arrest.astype(int)
|
298 |
|
299 |
# transform columns into intervals
|
300 |
data = data[(~data.in_custody.isna()) & (~data.out_custody.isna())]
|
301 |
in_dates = data.in_custody.apply(datetime.date.fromisoformat)
|
302 |
out_dates = data.out_custody.apply(datetime.date.fromisoformat)
|
303 |
days_in_custody = [delta.days for delta in out_dates - in_dates]
|
304 |
+
data["days_in_custody"] = days_in_custody
|
305 |
data.drop("in_custody", axis="columns", inplace=True)
|
306 |
data.drop("out_custody", axis="columns", inplace=True)
|
307 |
|