I have the following dataframe
dict1 = {'x_math_lp': {'John':'0',
'Lisa': 1,
'Karyn': '2'},
'o_math_lp': {'John': 0.005,
'Lisa': 0.001,
'Karyn':0.9}}
df= pd.DataFrame(dict1)
I would like to apply a condition such that if a value in the first column is less than 1 and the value in the 2nd column if >= 0.05, then replace the value in the first column with 'NaN'
Results should look like this
x_math_lp o_math_lp
John NaN 0.005
Lisa 1 0.001
Karyn NaN 0.900
Note: The reason why I want to use a loop is because my true dataframe has 30 columns and I was to do it for every column pair set in the dataframe, essentially, updating the entire dataframe.