Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to add row in spark dataframe

# Create hard coded row
unknown_list = [[‘0’, ‘Unknown’]]
# turn row into dataframe
unknown_df = spark.createDataFrame(unknown_list)
# union with existing dataframe
df = df.union(unknown_df)
 
PREVIOUS NEXT
Tagged: #add #row #spark #dataframe
ADD COMMENT
Topic
Name
5+2 =