This question is an exact duplicate of:
- spark data frame operation row and column level useing scala 1 answer
Original Data frame
+------+--------+
| name| country|
+------+--------+
|Raju |UAS |
|Ram |Pak |
|null |China |
|null |null |
+------+--------+
I Need this
+------+--------+
|Namwet|wet Con |
+------+--------+
|0.2 | 0.3 |
|0.2 | 0.3 |
|0.0 | 0.3 |
|0.0 | 0.0 |
+------+--------+
i want to create one Udf for both columns which will apply to Name Column it check them, if it not null then it return should 0.2, otherwise should return 0.0 . and same Udf apply to country column check if it null return 0.0 . not null then it return 0.3