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"))
DataFrame
s 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.
you can achieve same in java this way
Dataset<Row> filteredData = dataset.na().fill(0);