利用字典构建dataframe。
from pyspark.sql import SparkSession,Row spark = SparkSession.builder.appName("get_app_category").enableHiveSupport().config("spark.driver.host", "localhost").config("spark.debug.maxToStringFields", "100").getOrCreate() dict=[{'c1':'a','c2':'b'},{'c1':'c','c2':'d'}] spark.createDataFrame(dict).show()