I'm trying to find a way to calculate the mean of rows in a Spark Dataframe in Scala where I want to ignore NAs. In R, there is a very convenient function called rowMeans where one can specify to ignore NAs:
rowmeans(df,na.rm=TRUE)
I'm unable to find a corresponding function for Spark Dataframes, and I wonder if anyone has a suggestion or input if this would be possible. Replacing them with 0 won't due since this will affect the denominator.
I found a similar question here, however my dataframe will have hundreds of columns.
Any help and shared insights is appreciated, cheers!