lundi 27 juin 2016

pandas number >mean(), or

I have a dataframe like this:

Id  F   M   R
7   1   286 907
12  1   286 907
17  1   186 1271
21  1   296 905
30  1   308 908
32  1   267 905
40  2   591 788
41  1   486 874
47  1   686 906
74  1   230 907

for each row if f> f's mean() and M> M's mean() and R>R's mean(),then output in new column is "1".

like this:

Id  F   M   R    score
7   1   286 907    1
12  1   286 907    0 
17  1   186 1271   1 
21  1   296 905
30  1   308 908
32  1   267 905
40  2   591 788
41  1   486 874
47  1   686 906
74  1   230 907

Aucun commentaire:

Enregistrer un commentaire