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

Solution: Import the 'SparkContext' module

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

from pyspark import SparkContext

 

For more information:
Python pyspark SparkContext