I have a dataframe called V_test, which looks a bit like this:
| offer_code | min_age_actual | min_age_allowed
-|------------|----------------|----------------
0| 123 | 18 | 18
1| 456 | 49 | 50
2| 789 | 20 | NaN
I want to create a new column which flags as 1 any rows where the actual minimum age is lower than the minimum age allowed (if there is one). All others would be flagged as 0. So the desired result would look like this:
| offer_code | min_age_actual | min_age_allowed | flag
-|------------|----------------|-----------------|-----
0| 123 | 18 | 18 | 0
1| 456 | 49 | 50 | 1
2| 789 | 20 | NaN | 0
Does anyone know how to do this please?