-
-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: unhashable type: 'numpy.ndarray' #94
Comments
这个例子的代码有问题,dt_s 并没有定义。 |
你好,最近我发现使用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]可解决该问题,
|
pandas最好使用1.4以下的版本 |
你好,使用的是本项目readme提供的Example代码,dt_s定义了 |
谢谢,改成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代码运行成功。 |
谢谢,由于本地还有其他功能,更改版本可能影响现有功能 |
pandas 的向前兼容有点问题,可以试试R版本的scorecard,速度更快、也更稳定。python版本的包更新,需要等我处理好手上的其他事情。 |
(cherry picked from commit 03ec284)
It should be fixed. |
执行安装命令pip install scorecardpy后,运行Example代码报错,
出错语句为:
woe binning ------
bins = sc.woebin(dt_s, y="creditability")
报错信息:
TypeError: unhashable type: 'numpy.ndarray'
The text was updated successfully, but these errors were encountered: