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

Solution: Import the 'SparkSession' module

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

from pyspark.sql import SparkSession

 

For more information:
Python pyspark SparkSession