zhihu-baseline icon indicating copy to clipboard operation
zhihu-baseline copied to clipboard

data[feat] = lbe.fit_transform(data[feat]) 会报错

Open PengboLiu opened this issue 4 years ago • 3 comments

报错如下: Traceback (most recent call last): File "/home/pengboliu/anaconda3/lib/python3.7/site-packages/sklearn/preprocessing/label.py", line 105, in _encode res = _encode_python(values, uniques, encode) File "/home/pengboliu/anaconda3/lib/python3.7/site-packages/sklearn/preprocessing/label.py", line 59, in _encode_python uniques = sorted(set(values)) TypeError: '<' not supported between instances of 'str' and 'float'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pengboliu/workspace/Windows/zhihu/deepfm.py", line 77, in data[feat] = lbe.fit_transform(data[feat]) File "/home/pengboliu/anaconda3/lib/python3.7/site-packages/sklearn/preprocessing/label.py", line 236, in fit_transform self.classes_, y = _encode(y, encode=True) File "/home/pengboliu/anaconda3/lib/python3.7/site-packages/sklearn/preprocessing/label.py", line 107, in _encode raise TypeError("argument must be a string or number") TypeError: argument must be a string or number

PengboLiu avatar Oct 17 '19 01:10 PengboLiu