I have a dataframe such as
Names Values
A 0.20
A 1.30
A 1.2
B 0.30
B 0.40
C 1.2
D 0.70
E 0.12
E 1.3
F 0.90
F 0.78
F 0.88
And I would like to add to a New_col
the number :
1
where for eachNames
with at least oneValues > 0.75
and oneValues < 0.75
0
for eachNames
with onlyValues > 0.75
2
for eachNames
with onlyValues < 0.75
I should then get:
Names Values New_col
A 0.20 1
A 1.30 1
A 1.2 1
B 0.30 2
B 0.40 2
C 1.2 0
D 0.70 2
E 0.12 1
E 1.3 1
F 0.90 2
F 0.78 2
F 0.88 2