Skip to content
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: 'list' #34

Closed
oakley04 opened this issue Sep 25, 2019 · 8 comments
Closed

TypeError: unhashable type: 'list' #34

oakley04 opened this issue Sep 25, 2019 · 8 comments

Comments

@oakley04
Copy link

[woebin.py]
line 1020: dtx_suffix = pd.merge(dtx, binx, how='left', on=x_i).sort_values('rowid')
.set_index(dtx.index)[['_'.join([x_i,woe_points])]]

raise error on col "other.installment.plans" :
TypeError: unhashable type: 'list'
++++++++++++++++++++++++++++++++
other.installment.plans
0 [bank, stores]
1 [none]

@ShichenXie
Copy link
Owner

please provide a sample data and codes to reproduce your issue. Thanks

@Anaxximandar
Copy link

I have the same error when I follow the example provided after this : train_woe = sc.woebin_ply(train, bins_adj). the data are germancredit (not my own data).
I installed the version from pip install git+git://github.com/shichenxie/scorecardpy.git

Traceback (most recent call last):

File "", line 1, in
train_woe = sc.woebin_ply(train, bins_adj)

File "C:\Users\HP\AppData\Local\conda\conda\envs\myenv\lib\site-packages\scorecardpy\woebin.py", line 1137, in woebin_ply
dat_suffix = pool.starmap(woepoints_ply1, args)

File "C:\Users\HP\AppData\Local\conda\conda\envs\myenv\lib\multiprocessing\pool.py", line 276, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()

File "C:\Users\HP\AppData\Local\conda\conda\envs\myenv\lib\multiprocessing\pool.py", line 657, in get
raise self._value

TypeError: unhashable type: 'list'

@ShichenXie
Copy link
Owner

are you using Windows OS?

@Anaxximandar
Copy link

Anaxximandar commented Sep 29, 2019 via email

@laurencedaycf
Copy link

Hi @ShichenXie! Just wondering if Windows OS is the issue with this?
I get this same error with woebin_ply, and I am using Windows OS. Will using e.g. Ubuntu/Mac Fix this for me?

@ShichenXie
Copy link
Owner

which version of python are you using. The scorecardpy only supports python 3.6 or below.

@laurencedaycf
Copy link

laurencedaycf commented Oct 28, 2019

@ShichenXie I have tested on python versions 3.7.4, 3.6.9, and 3.5.6 and I get errors for all three of them

Here is the full output

[INFO] converting into woe values ...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\multiprocessing\pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\scorecardpy\woebin.py", line 1020, in woepoints_ply1
dtx_suffix = pd.merge(dtx, binx, how='left', on=x_i).sort_values('rowid')
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\pandas\core\reshape\merge.py", line 83, in merge
return op.get_result()
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\pandas\core\reshape\merge.py", line 642, in get_result
join_index, left_indexer, right_indexer = self._get_join_info()
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\pandas\core\reshape\merge.py", line 859, in _get_join_info
(left_indexer, right_indexer) = self._get_join_indexers()
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\pandas\core\reshape\merge.py", line 838, in _get_join_indexers
self.left_join_keys, self.right_join_keys, sort=self.sort, how=self.how
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\pandas\core\reshape\merge.py", line 1304, in _get_join_indexers
llab, rlab, shape = map(list, zip(*map(fkeys, left_keys, right_keys)))
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\pandas\core\reshape\merge.py", line 1903, in _factorize_keys
rlab = rizer.factorize(rk)
File "pandas/_libs/hashtable.pyx", line 77, in pandas._libs.hashtable.Factorizer.factorize
File "pandas/_libs/hashtable_class_helper.pxi", line 1805, in pandas._libs.hashtable.PyObjectHashTable.get_labels
File "pandas/_libs/hashtable_class_helper.pxi", line 1718, in pandas._libs.hashtable.PyObjectHashTable._unique
TypeError: unhashable type: 'list'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "test_program.py", line 41, in
train_woe = sc.woebin_ply(train, bins)
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\site-packages\scorecardpy\woebin.py", line 1132, in woebin_ply
dat_suffix = pool.starmap(woepoints_ply1, args)
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\multiprocessing\pool.py", line 274, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "C:\Users\Laurence.Day.conda\envs\scorecard_py_3_5\lib\multiprocessing\pool.py", line 644, in get
raise self._value
TypeError: unhashable type: 'list'

@ShichenXie
Copy link
Owner

It should be the multiprocessing donot supporting windows OS. Try to set no_cores as 1 when using windows, or change to macOS / Linux. I will fix this bug in few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants