lundi 18 avril 2016

If statement on Python

I have a dataframe like this:

block_id   number_repair  t    lognum                           
2              1.666667  1.0  0.462098
4              4.500000  2.5  1.468807
5              2.750000  1.5  0.895880
7              1.250000  1.5  0.173287
8              4.833333  2.5  1.297204

I would like to generate a respective list of 'True' or 'False' value. If 't' > 2 then return 'true', else return 'false'. How should I write the code to return result like the below?

[false true false false true]

Aucun commentaire:

Enregistrer un commentaire