I want to get max value for each column of a dataframe in Spark. My code works just for one column (e.g. first):
val col = df.columns(0);
val Row(maxValue: Int) = df.agg(max(col)).head();
I don't know how to combine foreach and the code I have so that I can get max value for every column in the dataframe. (I do not know how many columns are in the dataframe and what are the column names)
Thanks.