© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Faisal Malik
Data engineer
col_a & col_b. col_b has some data that I want to move and replace NaN values in col_a...while keeping the rest of col_a the same.
How can I 'left' merge a column and get all the values from that one to replace the null values? Thank for your help!
Mark
If I understand the question correctly, then I think this StackOverflow question has the answer:
Pandas Use Value if Not Null, Else Use Value From Next Column
df["col_a"] = df["col_a"].fillna(df["col_b"])
Thank you so much!
Mark
If I understand the question correctly, then I think this StackOverflow question has the answer:
Pandas Use Value if Not Null, Else Use Value From Next Column
df["col_a"] = df["col_a"].fillna(df["col_b"])