I have a pandas dataframe in Python that looks something like
AccountID_x AccountId AmountCD_x AmountDOC_x AmountDoc_x 1 NaN 4001001
You can use combine_first to combine the two
df['new_col'] = df['AccountId'].combine_first(df['AccountID_x']) df['new_col'] 1 4001001copa 2 4001001copa 3 4001001copa 4 4001001copa