I have a data fame like that :
Timestamp | Value |
---|---|
2021-04-21 14:22:00 | 0 |
2021-04-21 14:23:00 | 0 |
2021-04-21 14:24:00 | 0 |
2021-04-21 14:25:00 | 1 |
2021-04-21 14:26:00 | 1 |
2021-04-21 14:27:00 | 0 |
2021-04-21 14:28:00 | 1 |
2021-04-21 14:29:00 | 1 |
2021-04-21 14:30:00 | 1 |
I wan to get the consecutive same values like that :
Begin Date | Another header | Consecutive values |
---|---|---|
2021-04-21 14:25:00 | 2021-04-21 14:26:00 | 2 |
2021-04-21 14:28:00 | 2021-04-21 14:30:00 | 3 |
I tried some solutions with numpy shift, or by using for / while loop, but it don't work ... Also, I saw some topics in stack overflow indeed.
Thanks !