Introduction
In this tutorial, we want to create a SparkSession with PySpark. In order to do this, we create a SparkSession object.
Import Libraries
First, we import the following python modules:
from pyspark.sql import SparkSession
Create SparkSession
Before we can work with Pyspark, we need to create a SparkSession. A SparkSession is the entry point into all functionalities of Spark.
In order to create a basic SparkSession programmatically, we use the following command:
spark = SparkSession \
.builder \
.appName("Python PySpark Example") \
.getOrCreate()
Conclusion
Congratulations! Now you are one step closer to become an AI Expert. You have seen that it is very easy to create a SparkSession using PySpark. We can simply create a SparkSession object. Try it yourself!
Also check out our Instagram page. We appreciate your like or comment. Feel free to share this post with your friends.