If it is a dataframe, I think you could try to use np.where
:
df['idealcol'] = np.where(df['A'].isnull(), df['B'] , df['A'])
1
solved Python: how to merge 2 columns without overwriting?
If it is a dataframe, I think you could try to use np.where
:
df['idealcol'] = np.where(df['A'].isnull(), df['B'] , df['A'])
1
solved Python: how to merge 2 columns without overwriting?