I encounter this error asking me to reshape the series. How could I resolve this?
I think that it is caused by X
being a 1D dimensional array. Indeed, this is a bit ambuigous because 1D vector could mean a single sample and many features or many samples and a single feature. That’s why scikit-learn requests to provide a 2-D array of shape (n_samples, n_features)
to remove the ambiguity.
The message tell you that:
- use
X.reshape(-1, 1)
to have a shape of(n_samples, 1)
- or
X.reshape(1, -1)
to have a shape of(1, n_features)
.
1 Like