I am trying to create an empty dataframe in Spark (Pyspark).
I am using similar approach to the one discussed here enter link description here, but it is not working.
At the time this answer was written it looks like you need some sort of schema
from pyspark.sql.types import * field = [StructField("field1", StringType(), True)] schema = StructType(field) sc = spark.sparkContext sqlContext.createDataFrame(sc.emptyRDD(), schema)