Spark 1.6.1, Scala api.
For a dataframe, I need to replace all null value of a certain column with 0. I have 2 ways to do this. 1.
myDF.withColumn("pipConfidence", when($"mycol".isNull, 0).otherwise($"mycol"))
2.
myDF.na.fill(0, Seq("mycol"))
Are they essentially the same or one way is preferred?
Thank you!