It might be strange, but I was wondering how to replace any number of a whole DataFrame's Column for null using Scala.
Imagine I have a nullable DoubleType column named col. There, I want to replace all numbers different to (1.0 ~ 10.0) by a null.
I tried unsatisfactorily the next code.
val xf = df.na.replace("col", Map(0.0 -> null.asInstanceOf[Double]).toMap)
But, as you realize in Scala when you convert a null into a Double it becomes represented as a 0.0, and this is not what I want. Besides, I can't realize any way to do it with a range of values. Therefore, I am thinking if there is any way to achieve this?