I am trying to create a new column by adding two existing columns in my dataframe, while preserving NULLS values if both existing columns contain null.
DataFrame 1:
╔═══╦═══╗
║ cola ║ colb ║
╠═══╬═══╣
║ 100 ║ 100 ║
║ null ║ 300 ║
║ 200 ║ null ║
║ 400 ║ 200 ║
║ null ║ null ║
╚═══╩═══╝
Expected Output:
╔═══╦═══╦═══╗
║ cola ║ colb ║ colc ║
╠═══╬═══╬═══╣
║ 100 ║ 100 ║ 200 ║
║ null ║ 300 ║ 300 ║
║ 200 ║ null ║ 200 ║
║ 400 ║ 200 ║ 600 ║
║ null ║ null ║ null ║
╚═══╩═══╩═══╝
I've seen a lot of similar questions to this where nulls are always transformed to 0 before the add.