how to add row in spark dataframe

Solutions on MaxInterview for how to add row in spark dataframe by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to add row in spark dataframe"
Baptiste
06 Jan 2021
1# Create hard coded row
2unknown_list = [[‘0’, ‘Unknown’]]
3# turn row into dataframe
4unknown_df = spark.createDataFrame(unknown_list)
5# union with existing dataframe
6df = df.union(unknown_df)