How to ensure data imported matches sklearn requirements for processing?

Viewed 44

I am trying to get started on some machine learning on SKlearn I am getting this massive error that I have no idea where to start

*

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14812/623750250.py in <module>
----> 1 model.fit(X_train,y_train)
      2 predictions = model.predict(X_test)

ValueError: could not convert string to float: '[38.66999816894531, 39.125, 37.0, 37.29999923706055, 31.34000015258789, 31.0, 32.54999923706055, 32.0, 28.64999961853027, 30.5, 30.25, 30.0, 28.68000030517578, 30.13999938964844, 34.5, 34.5, 33.38000106811523, 

This is my code:

df = pd.read_excel('C:/Users/radoy/Programming/ML Chart Patterns/xx_combined.xlsx')
X = df.drop(columns=['consolidating'])
y = df['consolidating']

X_train, X_test, y_train, y_test = train_test_split(X,y, test_size=0.2)

model = DecisionTreeClassifier()

model.fit(X_train,y_train)
predictions = model.predict(X_test)

score = accuracy_score(y_test, predictions)
score

And this is an excerpt of the data, a lot of lists of different lengths. I have about 100 lines of data and am aware that this is highly insufficient, but I just want to get started from somewhere.

enter image description here

0 Answers
Related