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

Solution: Import the 'KMeans' module

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

from sklearn.cluster import KMeans

 

For more information:
Python sklearn KMeans