当前位置:   article > 正文

python计算IV值_jupyter求iv 固定十分箱

jupyter求iv 固定十分箱

1. pdf分页使用的是\newpage 或者 \pagebreak;

https://stackoverflow.com/questions/25240541/how-to-add-newpage-in-rmarkdown-in-a-smart-way

2. python计算IV值

  1. def compute_IV(df, variable, target):
  2. """
  3. to compute the IV of the variable
  4. df: data frame;
  5. variable: compute its IV;
  6. target: the target(1 or 0)
  7. reference: https://gist.github.com/Kirili4ik/1364c8666b042854b35c04b5b82be720
  8. """
  9. df = df[[variable, target]].copy()
  10. df[target] = np.where(df[target] == 1, 'Good', 'Bad')
  11. df = df.groupby([variable, target]).size().reset_index()
  12. df.rename(columns={0: 'size'}, inplace=True)
  13. import itertools
  14. df2 = pd.DataFrame(itertools.product(list(df[variable].unique()),
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/177665
推荐阅读
相关标签
  

闽ICP备14008679号