pip install XXDScorecard
scorecard developing utilities.
import XXDScorecard.XXDBinning as binning
from sklearn.model_selection import train_test_split
df = pd.read_csv('data.csv')
train_df, test_df = train_test_split(df,test_size=0.3,random_state=100,stratify=df.flgGood)
nb = binning.XXDNumberBin()
nb.pct_bin(train_df,'req_inc_ratio','flgGood',max_bin=10)
nb.get_bin_stats()
nb.plot_woe()
nb.trans_to_woe(test_df['req_inc_ratio'])
nb.manual_bin(train_df,'req_inc_ratio','flgGood',[20,30,40])
nb.monotone_bin(train_df,'req_inc_ratio','flgGood',max_bin=3)
cb = binning.XXDCharBin()
cb.pct_bin(train_df,'name','flgGood')
cb.plot_woe()
cb.get_bin_stats()
cb.manual_bin(train_df,'name','flgGood',[['yuqing','xuxiaodong'],['jack ma'],['yq','dd','xxd','qq']])
cb.trans_to_woe(test_df['name'])