python报错:使用lgb过程中报错:DataFrame.dtypes for data must be int, float or bool
2018-11-02 12:05
976 查看
产生原因:用来训练的样本中包含了非 int, float or bool的数据类型
修改:增加部分代码
from sklearn import preprocessing lbl = preprocessing.LabelEncoder() train_x['acc_id1'] = lbl.fit_transform(train_x['acc_id1'].astype(str))#将提示的包含错误数据类型这一列进行转换
LabelEncoder 可以用来规范标签也可以转换非数字标签(只要它们具有可比性)。
相关文章推荐
- python 学习---isinstance() arg 2 must be a type or tuple of types
- Unable to determine the principal end of an association between the types '***. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
- 我在使用redux过程中遇到Actions must be plain objects. Use custom middleware for async actions.异常的分析
- Python之Headers value 1 must be of type str or bytes, not <class 'int'>错误的解决
- Python ctypes 在 Python 2 和 Python 3 中的不同 // 使用ctypes过程中问题汇总
- SharePoint 报错: The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less
- 异常 int() argument must be a string or a number, not 'ShopCar'
- iOS - Applications must be ready for upload on iTunes Connect before they can be validated or submit
- python3爬虫问题 POST data should be bytes or an iterable of bytes
- Python 基础 - 3 常用数值类型(int,float,bool)定义
- python中使用iterrows()对dataframe进行遍历的实例
- iOS中使用opencv碰到这样的编译错误:non-const static data member must be initialized out of line
- 2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
- 数据结构之--series,DataFrame.use python and pandas for data mining
- Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named
- 使用 python3.6 调用 jieba 库出现的 ValueError: dictionary file dict.txt must be utf-8 错误
- tensorflow报错:Shape must be rank 2 but is rank 3 for 'MatMul' (op: 'MatMul')
- python3-网络编程-TypeError: send() argument 1 must be bytes or buffer, not str异常
- python使用rrdtool时 argument 0 must be string的问题
- Should you teach Python or R for data science?