close

[Solved] Import: No module named sklearn.cross_validation

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Import: No module named sklearn.cross_validation in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Import: No module named sklearn.cross_validation Error Occurs?

Today I get the following error Import: No module named sklearn.cross_validation in python.

How To Solve Import: No module named sklearn.cross_validation Error ?

  1. How To Solve Import: No module named sklearn.cross_validation Error ?

    To Solve Import: No module named sklearn.cross_validation Error sklearn.cross_validation has been deprecated. The function train_test_split can now be found here:

  2. Import: No module named sklearn.cross_validation

    To Solve Import: No module named sklearn.cross_validation Error sklearn.cross_validation has been deprecated. The function train_test_split can now be found here:

Solution 1

sklearn.cross_validation has been deprecated. The function train_test_split can now be found here:

from sklearn.model_selection import train_test_split

Simply replace the import statement from the question to the one above.

Solution 2

What’s your sklearn version? You can find out with sk.__version__

It’s possible that it has been moved to sklearn.model_selection

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read