I have a spark data frame df. Is there a way of sub selecting a few columns using a list of these columns?
df
scala> df.columns res0: Array[Stri
Yes , You can make use of .select in scala.
Use .head and .tail to select the whole values mentioned in the List()
Example
val cols = List("b", "c") df.select(cols.head,cols.tail: _*)
Explanation