0

I have the following code, where I'm converting categorical variables into numeric ones.

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)

I'm getting an error as

'>'  is not supported between instances of 'str' and 'float'

Please advise, where did I go wrong?

Fabian N.
  • 3,807
  • 2
  • 23
  • 46
iahmed
  • 155
  • 1
  • 2
  • 12

0 Answers0