Question: Given a dataframe, how do I calculate the probability of consecutive events using python pandas?

For example,

| Time | A | B | C |
| --- | --- | --- | --- |
| 1 | 1 | 1 | 1 |
| 2 | -1 | -1 | -1 |
| 3 | 1 | 1 | 1 |
| 4 | -1 | -1 | -1 |
| 5 | 1 | 1 | 1 |
| 6 | -1 | -1 | -1 |
| 7 | 1 | 1 | 1 |
| 8 | -1 | 1 | 1 |
| 9 | 1 | -1 | 1 |
| 10 | -1 | 1 | -1 |

In this dataframe, B has two consecutive "1" in t=7 and t=8, and C has three consecutive "1" in t=7 to to=9.

Probability of event that two consecutive "1" appear is 3/27
Probability of event that three consecutive "1" appear is 1/24

How can I do this using python pandas?

Answer: 
Although red container has infinite size, You put it in a scaffold's body which has specific size. so your red container get specific size then your grin container with no child get size as much as its parents.
The red `container` actually will has size as small as posibble depends its child.

the green container has no child, then as the documentation said it will try to be as big as possible unless the incoming constraints are unbounded,

if you change the child , like Text widget, or Column, or other widget, it will not get the maximum size.