value_replace - shuiwanghuohuo/scorecard_wiki GitHub Wiki

import card_tool as ct
ct.value_replace(feature_data, bin_score, not_in_list=["None", "NaN", "NA", "nan", None, "-999", "-999.0", -999, "-1111", "-1111.0", -1111], type="bin")
测试时的指标值替换

Parameter Description
---------------------
feature_data : pandas.core.frame.DataFrame
    测试数据集

bin_score : pandas.core.frame.DataFrame
    评分卡信息

not_in_list : list,(default=["None", "NaN", "NA", "nan",None, "-999", "-999.0", -999,"-1111","-1111.0",-1111])
    空值列表,在列表中的值会被认为空值

type : string,(default="bin")
    转换类型,可选"bin","score",分别对应箱和分数
    "bin"例子:5,2,6,10 ====>(2,6],(-INF,2],(2,6],[6,10]
Return
------
result : 一个pandas dataframe 包括了每个特征的变量名,单一阈值