【发布时间】:2020-03-04 18:13:15
【问题描述】:
col = ['date','age','race', 'sex','procedure1', 'procedure2', 'procedure3', 'a_diag', 'p_diag','s_diag1','s_diag2', 's_diag3', 's_diag4', 's_diag5']
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
for i in col:
df[i] = le.fit_transform(df[i].astype('object'))
对于上面的代码,我得到以下错误:
'<' not supported between instances of 'str' and 'int'
【问题讨论】:
-
提供完整的错误信息
-
欢迎来到 Stack Overflow!查看tour 和How to Ask。您需要提供minimal reproducible example。你可以edit你的帖子。
标签: python-3.x scikit-learn data-science