Boris K
Boris K

Reputation: 3580

SciKitLearn tree returning error

I'm trying to build a decision tree with SciKitLearn, and it tells me: Input contains NaN, infinity or a value too large for dtype('float64').

Running .isnull().any() on the input data returns False for every column.

There are four input columns of type float64; the data in them is properly formatted to two decimal places, no crazy values.

What might the culprit be and how can I fix it?

y = df["CutoffValue"]
X = df_new
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X,y)

Upvotes: 1

Views: 59

Answers (1)

Boris K
Boris K

Reputation: 3580

Fixed it! In this case, "input" in the error refers to LABELED data, the y! Dropped nulls for the column, and all is ok.

Upvotes: 1

Related Questions