Pikachu
Pikachu

Reputation: 314

Module import error while importing train_test_split

I am trying to import the train_test_split from sklearn by using

 from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)

Every time I am getting the same error saying:

Module import error, module not found

I have tried creating a virtual environment in conda and also ran

conda update -all

I am still getting the same error.

Upvotes: 2

Views: 144

Answers (1)

Renaud
Renaud

Reputation: 2819

Replace

from sklearn.cross_validation import train_test_split

By

from sklearn.model_selection import train_test_split

Upvotes: 1

Related Questions