I am trying to have a conditional counter in a pandas data table. It is supposed to add up when values are below 1, as soon as a value is above 1, the counter is supposed to start again at 0. I think it's simple, but unfortunately I haven't found the solution.
| Week | A | B |
|---|---|---|
| 01-2022 | 0.8 | 1 |
| 02-2022 | 0.6 | 2 |
| 03-2022 | 1.5 | 0 |
| 04-2022 | 0.6 | 1 |
| 05-2022 | 0.8 | 2 |
| 06-2022 | 0.8 | 3 |
Thanks for helping me out.