I have a Spark dataframe which consists of empty values in a row. I want to replace null to value of that in another column.
A B
2017 209
2019 208
2016 NA
2016 NA
2018 209
expected output:
A B
2017 209
2019 208
2016 2016
2016 2016
2018 209
I have tried using
na.replace
ifelse(is.na(df$B), df$A, df$B)
df$B[is.na(df$B)] = as.character(df$A[is.na(df$B)]
but I get an output with no changes