I am trying to train a very simple model using DecisionTreeClassifier().
iris.csv is my dataset.
dtc1 = DecisionTreeClassifier()
dtc1.fit(x1Train,y1Train)
predicted1 = dtc1.predict(x1Test)
predicted1
The error I am getting is, ValueError
Is this because my training x and y are numeric and strings?? How can I solve this?
I have tried to convert my x1, y1, and x1Train, y1Train to to_numpy()
but the same issue occurs.
Edit: Tried according to the comments.
x1Train.values.reshape(1,-1)
y1Train.values.reshape(1,-1)
dtc1.fit([x1Train],[y1Train]) #this line runs
predicted1 = dtc1.predict(x1Test.reshape(-1,1)) #this line gives error
predicted1
Error getting AttributeError