df = DataFrame(index=list(range(5)))
df['Value'] = ''
df2 = DataFrame(dict(A=['foo', 'foo', 'bar', 'bar', 'bah']))
df
df2
df.loc[df2.A.str.contains('foo'), 'Value'] = 'good'
df.loc[df2.A.str.contains('bar'), 'Value'] = 'bad'
df
Python pandas removing SettingWithCopyWarning