In other words, using .loc you would do
In [2008]: df Out[2008]: ORG1 ORG2 0 A ESBL 1 BP 2 CQ 3 DR 4 E ESBL In [2009]: df.loc[df['ORG2'] == 'ESBL', 'ORG1'] = df['ORG2'] In [2010]: df Out[2010]: ORG1 ORG2 0 ESBL ESBL 1 BP 2 CQ 3 DR 4 ESBL ESBL
Or, if you need a copy, without changing the original df , you can use .mask()
In [2016]: df.mask(df['ORG2'] == 'ESBL', df['ORG2'], axis=0) Out[2016]: ORG1 ORG2 0 ESBL ESBL 1 BP 2 CQ 3 DR 4 ESBL ESBL
Zero
source share