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

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)