I have a dataset made of True and False.
Sample Table:
A B C
0 False True False
1 False False False
2 True True False
3 True True True
4 False True False
5 True True True
6 True False False
7 True False True
8 False True True
9 True False False
I want to count the number of consecutive True values for every column, and if there's more than one consecutive True series, I want to get the max of it.
For the table above, I would get:
length = [3, 4, 2]
I found similar threads but none resolved my problem.
Since I do and will have many more columns(products), I need to do this regardless of the column name, for the whole table and get an array as the result.
And if possible, I'd like to learn the index of the first true of the longest sequence aka where this longest true series starts, so the result would be for this one:
index = [5, 2, 7]