Replace null values in Spark DataFrame

This is basically very simple. You’ll need to create a new DataFrame. I’m using the DataFrame df that you have defined earlier.

val newDf = df.na.fill("e",Seq("blank"))

DataFrames are immutable structures.
Each time you perform a transformation which you need to store, you’ll need to affect the transformed DataFrame to a new value.

Leave a Comment