def sorted_groupby(df, groupby):
    start = 0
    prev = df[groupby].iloc[start]
    for i, x in enumerate(df[groupby]):
        if x != prev:
            yield prev, df.iloc[start:i]
            prev = x
            start = i
    yield prev, df.iloc[start:]