When splitting a dataset, I get an error saying they are empty even though they don't seem empty [closed]
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 hours ago.
开发者_如何学编程 Improve this questionThis is the code I'm trying to run:
X = df.iloc[:, 0:-1]
y = df.iloc[:, -1]
X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.20, train_size = 0.80)
And this is the error I am getting.
ValueError: With n_samples=0, test_size=0.2 and train_size=0.8, the resulting train set will be empty. Adjust any of the aforementioned parameters.
The target attribute is assumed to be the last one and I'm writing a function that takes a dataset as input and returns the best-performing model from a list of models.
I printed X
and y
separately but neither of them is empty.
精彩评论