pypiscikit-learn95% confidence\u2191 100

ImportError: No module named model_selection

Full error message
I am trying to use train_test_split function and write:

from sklearn.model_selection import train_test_split

and this causes 

ImportError: No module named model_selection

Why? And how to overcome?

I guess you have the wrong version of scikit-learn, a similar situation was described here on GitHub. Previously (before v0.18), train_test_split was located in the cross_validation module: from sklearn.cross_validation import train_test_split However, now it's in the model_selection module: from sklearn.model_selection import train_test_split so you'll need the newest version. To upgrade to at least version 0.18, do: pip install -U scikit-learn (Or pip3, depending on your version of Python). If you've installed it in a different way, make sure you use another method to update, for example when using Anaconda.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/74e9242a5f0793d2536d36cffb265ba944fe250af6640524b32fcf7096e1bee1
hash \u00b7 74e9242a5f0793d2536d36cffb265ba944fe250af6640524b32fcf7096e1bee1
ImportError: No module named model_selection — DepScope fix | DepScope