欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

解决 IndexError: arrays used as indices must be of integer (or boolean) type

程序员文章站 2022-06-12 22:46:16
...

使用sklearn处理数据,进行数据标签分类转化,报错如下:

Traceback (most recent call last):
File “.py", line 67, in
pa = le.ina(pa)
File "/r
el.py”, line 14, in inform
return s*s_[y]
IndexError: arrays used as indices must be of integer (or boolean) type

解决方法:

s = s.astype('int64')
s = le.inverse_transform(s)
相关标签: sklearn