I have a list of column names in Scala like
var cols = List("col1", "col2", "col3","col4")
Also I have a data frame with these columns but all in string. Now I would like to cast columns of dataframe by iterating through list or columns of dataframe because my list of columns is very large and I cant afford using so many .withColumn
arguments
Thanks in Advance