Is there a way to remove columns of a spark info frame that contain only null values? (I use scala and Spark 1.6.2)
I am currently doing this:
var validCols: List[String] = List()
for (col <- df_filtered.columns){
val count = df_filtered
.select(col)
.distinct
.count
println(col, count)
if (count >= 2){
validCols ++= List(col)
}
}
to create a list of columns containing at least two different values, and then use it in select ().
Thank!
source
share