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

Solution: Import the 'col' module

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

from pyspark import col

 

For more information:
Python pyspark col