Giter Site home page Giter Site logo

Comments (8)

ShichenXie avatar ShichenXie commented on August 12, 2024

这个例子的代码有问题,dt_s 并没有定义。

from scorecardpy.

HEHEOMG avatar HEHEOMG commented on August 12, 2024

你好,最近我发现使用sc.woebin会报错,TypeError: unhashable type: 'numpy.ndarray',通过尝试,发现在该函数在环境为python3.7的win/mac/linux能正常运行,环境为python3.8的mac/linux也能运行,但在3.8的windows下报错,原因是scorecardpy.woebin.woebin2_init_bin()函数中下面这段代码中,np.unique(x)会产生一个numpy.ndarray类型,应该是pandas版本的原因,将其改成np.unique(x)[0]可解决该问题,

    init_bin = init_bin.groupby('brkp').agg({
      'variable':lambda x: np.unique(x),
      'bin': lambda x: '%,%'.join(x),
      'good': sum,
      'bad': sum
    }).assign(badprob = lambda x: x['bad']/(x['good']+x['bad']))\
    .reset_index()

from scorecardpy.

Roll113 avatar Roll113 commented on August 12, 2024

pandas最好使用1.4以下的版本

from scorecardpy.

Jarye0612 avatar Jarye0612 commented on August 12, 2024

这个例子的代码有问题,dt_s 并没有定义。

你好,使用的是本项目readme提供的Example代码,dt_s定义了
刚接触这块内容,还想问下这个项目实现基于哪些文档资料或者链接,是否方便告知下,以了解有些代码为什么这么写?

from scorecardpy.

Jarye0612 avatar Jarye0612 commented on August 12, 2024

你好,最近我发现使用sc.woebin会报错,TypeError: unhashable type: 'numpy.ndarray',通过尝试,发现在该函数在环境为python3.7的win/mac/linux能正常运行,环境为python3.8的mac/linux也能运行,但在3.8的windows下报错,原因是scorecardpy.woebin.woebin2_init_bin()函数中下面这段代码中,np.unique(x)会产生一个numpy.ndarray类型,应该是pandas版本的原因,将其改成np.unique(x)[0]可解决该问题,

    init_bin = init_bin.groupby('brkp').agg({
      'variable':lambda x: np.unique(x),
      'bin': lambda x: '%,%'.join(x),
      'good': sum,
      'bad': sum
    }).assign(badprob = lambda x: x['bad']/(x['good']+x['bad']))\
    .reset_index()

谢谢,改成np.unique(x)[0]这个方法解决了这个问题,但执行readme中的Example代码又报了一个错:ValueError: Number of rows must be a positive integer, not 1.0,通过将scorecardpy-perf.py中 perf_eva 的subplot_nrows,subplot_ncols强制转化为整数解决。解决这两个问题后,在本地环境(本地环境 python3.10.4,pandas1.4.3)运行readme中Example代码运行成功。

from scorecardpy.

Jarye0612 avatar Jarye0612 commented on August 12, 2024

pandas最好使用1.4以下的版本

谢谢,由于本地还有其他功能,更改版本可能影响现有功能

from scorecardpy.

ShichenXie avatar ShichenXie commented on August 12, 2024

pandas 的向前兼容有点问题,可以试试R版本的scorecard,速度更快、也更稳定。python版本的包更新,需要等我处理好手上的其他事情。

from scorecardpy.

ShichenXie avatar ShichenXie commented on August 12, 2024

It should be fixed.

from scorecardpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.