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)