Skip to content Skip to sidebar Skip to footer

Indexing A Csv Running Into Inconsistent Number Of Samples For Logistic Regression

I'm currently indexing a CSV with values below and running into the error: ValueError: Found input variables with inconsistent numbers of samples: [1, 514] It's examining it as

Solution 1:

As there is only 1 feature in your X_train, its current shape is (n_samples,). But scikit estimators require X to be of shape (n_samples, n_features). So you need to reshape your data.

Use this:

logreg.fit(X_train.reshape(-1,1), y_train).fillna(0.0)

Post a Comment for "Indexing A Csv Running Into Inconsistent Number Of Samples For Logistic Regression"