I have df:
id color val
1 y 3
1 y 3
1 y 3
2 y 1
2 r 2
I want to count the condition that the value in val column is <=3 at least 3 times in the same id and color in a row(in sequence), and when the condition is true, to return the id and color. for example I will get here 1,y thanks