From 5c7504945b11a36a8b5ef264e3263c98f7141ded Mon Sep 17 00:00:00 2001 From: Aniruddha Adak Date: Tue, 29 Sep 2026 05:37:06 +0530 Subject: [PATCH] fix: convert age and education-num to numeric in load_preproc_data_adult Signed-off-by: Aniruddha Adak --- .../optim_preproc_helpers/data_preproc_functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py b/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py index 708ca135..f2839f4c 100644 --- a/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py +++ b/aif360/algorithms/preprocessing/optim_preproc_helpers/data_preproc_functions.py @@ -10,6 +10,7 @@ def custom_preprocessing(df): """ # Group age by decade + df['age'] = pd.to_numeric(df['age'], errors='coerce') df['Age (decade)'] = df['age'].apply(lambda x: x//10*10) # df['Age (decade)'] = df['age'].apply(lambda x: np.floor(x/10.0)*10.0) @@ -35,6 +36,7 @@ def group_race(x): # Cluster education and age attributes. # Limit education range + df['education-num'] = pd.to_numeric(df['education-num'], errors='coerce') df['Education Years'] = df['education-num'].apply(lambda x: group_edu(x)) df['Education Years'] = df['Education Years'].astype('category')