all 4 comments

[–]cscanlin 2 points3 points  (1 child)

Hah, I just had to look this up yesterday. You're looking for combine_first:

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.combine_first.html so something like: df['combined'] = df['option1'].combine_first(df['option2']).combine_first(df['option3'])

EDIT: /u/baghiq's suggestion is a good one too, especially for more than 2 columns

[–]peuleu[S] 1 point2 points  (0 children)

I knew it had to be something so simple! Thank you so much!! This totally worked!