I have rainfall time series like:
rainfall
0 3.1
1 2
2 0
3 0
4 12
5 0
6 1
7 2
8 3
9 6
10 1
11 2
12 9
I wanted to use python pandas to Flag an observation that has its previous 4 readings meeting this condition: for each i in range (len(observations))==> i+1>i
The expected output would be something like this:
rainfall Flag test
0 3.1 F
1 2 F
2 0 F
3 0 F
4 12 F
5 0 F
6 1 F
7 2 F
8 3 T
9 6 T
10 1 F
11 2 F
12 9 F
where it is returning T only for 9th row where previous 3 had this condition.
I was wondering if somebody could help me.