Let's consider a dataframe like this:
(index) condition number
0 'increase' 1
1 'do-nothing' 1
I'd like to increment the elements in the number column if the condition element in the same row is equal to 'increase'. In principle, I thought about something similar:
# non-working example
df['number'] = df['number'].apply(lambda x: x+=1 if x['condition'] == 'increase' else x)
This example of course does not work. Is there an efficient method to do it?