I have the following dataframe:
num
Out[89]:
Date
2015-07-06 33
2015-07-07 20
2015-07-08 4
2015-07-09 3
2015-07-10 8
..
2020-06-29 14
2020-06-30 13
2020-07-01 18
2020-07-02 20
2020-07-03 28
Length: 1228, dtype: int64
I want to apply something like num.lt(5) on shifting basis every n days. Such as if it were able to find 5 but the day after there was a lower value of 4 and then 3, so on an interval of lets say 3 days it logs the value 3. So essentially what should happen is less than 5 but the minimum value lowest in the next 3 days. How can i do this?
For example :
Date
2015-07-06 33
2015-07-07 20
2015-07-08 4
2015-07-09 3
2015-07-10 8
On date 2015-07-08 it has a value of 4 which is true if I use lt(5) but the day after it has 3. I want it so that it logs 3 instead of both 4 and 3 because 3 is the lowest value. It should check on 3 days interval. Thus if it started to check for condition on 2015-07-08 it should check for the lowest value for the next 3 days which is till 2015-07-11. Could you please advise this could be done?
Edit:
So wherever lt(5) is true will be the starting point and the next 3 days is where the lowest value needs to be found. The search for should only start at the end of the interval for the next starting point of lt(5)