I would like to add a condition by last n rows values of another column.
For example, I have column A and if last 3 A rows are <= 25, I would like to add a 1 in column B but in next row AFTER the condition met:
In this case, rows [3,4,5] meet the condition (all are <= 25) so I'll add a "1" in B in next row (row number 6 of B).
Also rows [12,13,14] meet the condition.
I tried something like this for split values in 3 last rows
for i in range(0,len(l),n):
yield l[i:i + n]
But I get stuck in add column B
Thanks!
