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.
Related Posts:
- No module named ‘sklearn.cross_validation’
- ValueError: Unknown label type: ‘continuous’
- Converting list to numpy array
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- TypeError: cannot perform reduce with flexible type
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- How to normalize a NumPy array to a unit vector?
- ModuleNotFoundError: No module named ‘sklearn’
- Arrays used as indices must be of integer (or boolean) type
- How can I plot a confusion matrix? [duplicate]
- ModuleNotFoundError: No module named ‘sklearn’
- How to normalize a NumPy array to a unit vector?
- Arrays used as indices must be of integer (or boolean) type
- sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2."
- RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
- Difference between scikit-learn and sklearn
- Get Confusion Matrix From a Keras Multiclass Model
- What’s the difference between scikit-learn and tensorflow? Is it possible to use them together?
- Scikit-learn GridSearch giving “ValueError: multiclass format is not supported” error
- ImportError in importing from sklearn: cannot import name check_build
- Can sklearn random forest directly handle categorical features?
- how to check which version of nltk, scikit learn installed?
- Got continuous is not supported error in RandomForestRegressor
- Python/Scikit-Learn – Can’t handle mix of multiclass and continuous
- ValueError: multiclass format is not supported
- How do I lowercase a string in Python?
- Difference between del, remove, and pop on lists
- How to use the pass statement
- How do you round UP a number?
- How do I update\upgrade pip itself from inside my virtual environment?
- ImportError: DLL load failed: The specified module could not be found
- Replacements for switch statement in Python?
- Correct way to write line to file?
- Depth-first search (DFS) code in python
- How to use Python to execute a cURL command?
- What does %s mean in a python format string?
- Redirecting to URL in Flask
- TypeError: ‘float’ object is not callable
- Plotting a 2D heatmap with Matplotlib
- Purpose of __repr__ method?
- json.dumps vs flask.jsonify
- How to print like printf in Python3?
- “Defaulting to user installation because normal site-packages is not writeable” python message
- How to install pytorch in Anaconda with conda or pip?
- Replace values in list using Python
- Trouble updating to Anaconda Navigator 1.10.0 (MacOS)
- Binary numbers in Python
- Django: ImproperlyConfigured: The SECRET_KEY setting must not be empty
- builtins.TypeError: must be str, not bytes
- How do you read from stdin?
- takes 1 positional argument but 2 were given
- What is dtype(‘O’), in pandas?
- Call a function from another file?
- What’s the difference between %s and %d in Python string formatting?
- What is the difference between Jupyter Notebook and JupyterLab?
- Python 3 ImportError: No module named ‘ConfigParser’
- Group by index + column in pandas
- Why am I getting a FileNotFoundError?
- Anaconda Navigator won’t launch (windows 10)
- What are all possible pos tags of NLTK?
- Can’t open Jupyter notebook with Anaconda
- How to change dataframe column names in pyspark?
- Pickle , read in data , unsupported pickle protocol: 3 python 2.7
- pygame clock.tick() vs framerate in game main loop
- How to implement a binary search tree in Python?
- TypeError: cannot unpack non-iterable NoneType object
- Search and replace a line in a file in Python
- Can’t import my own modules in Python
- What are the most common Python docstring formats?
- How do I install a pip package globally instead of locally?
- Python Array Rotation
- standard_init_linux.go:178: exec user process caused “exec format error”
- Why I get ‘list’ object has no attribute ‘items’?
- tar: Unrecognized archive format error when trying to unpack flower_photos.tgz, TF tutorials on OSX
- Repeating a function in Python
- How can I convert a .py to .exe for Python?
- How do I make a dictionary with multiple keys to one value?
- Directing print output to a .txt file
- range() for floats
- import pandas_datareader gives ImportError: cannot import name ‘is_list_like’
- How does tuple comparison work in Python?
- AttributeError: ‘float’ object has no attribute ‘split’4
- How to add pandas data to an existing csv file?
- What are the differences between numpy arrays and matrices? Which one should I use?
- Use different Python version with virtualenv
- Print empty line?
- write multiple lines in a file in python
- JSON object must be str, bytes or bytearray, not dict
- Is there a head and tail method for Numpy array?
- What should I use to open a url instead of urlopen in urllib3
- How to find out whether a file is at its `eof`?
- TypeError: Image data can not convert to float
- coercing to Unicode: need string or buffer, NoneType found when rendering in django admin
- What is related_name used for?
- Symbol not found: __PyCodecInfo_GetIncrementalDecoder
- How can I tail a log file in Python?
- How to write unicode strings into a file?
- python-How to set global variables in Flask?
- How do I install pip on macOS or OS X?