我有以下代码,我将分类变量转换为数字变量。
from sklearn.preprocessing import LabelEncoder
var_mod = ['Gender','Married','Dependents','Education','Self_Employed','Property_Area','Loan_Status']
le = LabelEncoder()
for i in var_mod:
df[i] = le.fit_transform(df[i])
print(df.dtypes)
我收到错误
'>' is not supported between instances of 'str' and 'float'
请告知,我哪里出错?