Problem
-------

I have the following Pandas dataframe:

```py
    data = {
        'ID':  [100, 100, 100, 100, 200, 200, 200, 200, 200, 300, 300, 300, 300, 300],
        'value': [False, False, True, False, False, True, True, True, False, False, False, True, True, False],
    }
    df = pandas.DataFrame (data, columns = ['ID','value'])

```

I want to get the following groups:

* Group 1: for each ID, all False rows until the first True row of that ID
* Group 2: for each ID, all False rows after the last True row of that ID
* Group 3: all true rows

[![enter image description here](https://i.stack.imgur.com/8Kr8Q.png)](https://i.stack.imgur.com/8Kr8Q.png)

Can this be done with pandas?

What I've tried
---------------

I've tried

```
group = df.groupby((df['value'].shift() != df['value']).cumsum())

```

but this returns an incorrect result.