How to Solve NameError: name 'VectorIndexer' is not defined -- pyspark

Solution: Import the 'VectorIndexer' module

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

from pyspark.ml.feature import VectorIndexer

 

For more information:
Python pyspark VectorIndexer