<human>:  Best way to split a DataFrame given an edge
<bot>: Here is some code to split dataframe `df` where the value of column `a` is equal to 'B'

df.groupby((df.a == 'B').shift(1).fillna(0).cumsum())

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.