- 导入必要的库
from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession
- 创建SparkSession
conf = SparkConf().setAppName("E-commerce User Behavior Analysis")
sc = SparkContext(conf=conf)
spark = SparkSession(sc)
- 读取数据
# 读取用户行为数据
user_behavior = spark.read