我有这样的数据帧:
point | switch_on |
---|---|
A | True |
B | True |
C | True |
A | False |
D | False |
N | True |
O | False |
O | False |
S | False |
我想添加另一个列,它将在切换之前确定包含相同布尔值的行组.就像这样:
point | switch_on | group |
---|---|---|
A | True | 1 |
B | True | 1 |
C | True | 1 |
A | False | 2 |
D | False | 2 |
N | True | 3 |
O | False | 4 |
O | False | 4 |
S | False | 4 |