How to apply conditional logic to a Pandas DataFrame.
See DataFrame shown below,
data desired_output
0 1 False
1 2 False
2 3 True
3 4 True
My original data is show in the 'data' column and the desired_output is shown next to it. If the number in 'data' is below 2.5, the desired_output is False.
I could apply a loop and do re-construct the DataFrame... but that would be 'un-pythonic'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…