I have simple dataframe:
import pandas as pd frame = pd.DataFrame(np.random.randn(4, 3), columns=list(\'abc\'))
Thus for example:
is that what you want?
In [300]: frame[['b','c']].apply(lambda x: x['c'] if x['c']>0 else x['b'], axis=1) Out[300]: 0 -1.099891 1 0.582815 2 0.901591 3 0.900856 dtype: float64