How to write value from a dataframe column to another column based in a condition?

I’m having some bad time here trying to figured out how to set a column-based in a condition. Basically, I want to copy the value from column “Customer” to the rows of the column “Call Ref”, if the row is different from ‘Enterprise’ and ‘Client’.

Follow the code I’m trying:

df_OCB['Call Ref'] = np.select([np.logical_and(df_OCB['Call Ref'] != 'Enterprise',df_OCB['Call Ref'] != 'Client')], df_OCB['Costomer'],default='')

Please, Does anyone have a good solution to share with me?

Answer

Have you tried with np.where()?

df_OCB['Call Ref'] = np.where((df_OCB['Call Ref'] != 'Enterprise') & (df_OCB['Call Ref'] != 'Client'), df_OCB['Customer'],'')