Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

ValueError:could not convert string to float: 'Rural'

$
0
0

@warrior wrote:

Hello all.

I ran the LabelEncoder code from the Tutorial along with

X_train = train_data.drop(‘Loan_Status’, axis=1)
y_train = train_data[‘Loan_Status’]
X_test = test_data

from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier()
clf.fit(X_train, y_train)

but when I run:

clf.predict(X_test)

I get ValueError:could not convert string to float: ‘Rural’ even though when I look at the dataframe the Property_Area variable was encoded.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles