How to apply conditional logic to a Pandas DataFrame.
See DataFrame shown below,
data desired_output 0 1 False 1 2 Fals
Just compare the column with that value:
In [9]: df = pandas.DataFrame([1,2,3,4], columns=["data"]) In [10]: df Out[10]: data 0 1 1 2 2 3 3 4 In [11]: df["desired"] = df["data"] > 2.5 In [11]: df Out[12]: data desired 0 1 False 1 2 False 2 3 True 3 4 True