My code looks like that:
if df['FLAG'] == 1:
df['VAL'] = df['VAL'].fillna(median)
elif df['FLAG'] == 0:
df['VAL'] = df['VAL'].fillna(0)
Which returns - The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I have tried with doing like a mask and then applying it with a.all() but it didn't worked out. I'd be very thankful for enlightment!
Edit: I've solution for my problem right here - Link