Friday, 21 August 2020

Create Empty Dataframe In Spark - Without Defining Schema

 

There may be cases where we need to initialize a Dataframe without specifying a schema.
Let's see how to do that
empty_DF = sqlContext.createDataFrame(sc.emptyRDD(),StructType([]))

StructType([]) This creates an empty schema for our dataframe.



2 comments:

  1. Nice blog and articles. I am realy glad to visit your blog. Presently I am discovered which I really need.

    360DigiTMG

    ReplyDelete
  2. This is a great motivational article. In fact, I am happy with your good work. They publish very supportive data, really. Continue. Continue blogging. Hope you explore your next post
    what is hrdf

    ReplyDelete