How to Solve NameError: name 'train_test_split' is not defined -- sklearn

Solution: Import the 'train_test_split' module

To Solve the error, add the following line to the top of your code.

from sklearn.model_selection import train_test_split

 

For more information:
Python train_test_split sklearn