from pyspark import SparkContext, SparkConf
= SparkConf().setMaster('local')
conf = SparkContext(conf=conf) sc
Set up spark in Jupyter Notebook
spark
jupyter notebook
Using the low-level RDD API
sc.stop()
Using high-level DSL operators and the DataFrame API
from pyspark.sql import SparkSession
= SparkSession.builder.appName('chapter2').getOrCreate() spark
spark.stop()