From 7d92152ef1cfe9b956a38c162c5a9e804d9ddc97 Mon Sep 17 00:00:00 2001 From: itlubber <1830611168@qq.com> Date: Fri, 23 Feb 2024 11:53:19 +0800 Subject: [PATCH] fix feature_bins --- scorecardpipeline/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scorecardpipeline/utils.py b/scorecardpipeline/utils.py index a6282a7..9c3d26b 100644 --- a/scorecardpipeline/utils.py +++ b/scorecardpipeline/utils.py @@ -189,9 +189,9 @@ def feature_bins(bins, decimal=4): for keys in bins: keys_update = set() for key in keys: - if pd.isnull(key) or key == "nan": + if pd.isnull(key) or (isinstance(key, str) and key == "nan"): keys_update.add("缺失值") - elif key.strip() == "": + elif isinstance(key, str) and key.strip() == "": keys_update.add("空字符串") else: keys_update.add(key)