Returns statistics about grouping changes

    Args:
        old (set of frozenset): old grouping
        new (set of frozenset): new grouping

    Returns:
        pd.DataFrame: df: data frame of size statistics

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_alg import *  # NOQA
        >>> import utool as ut
        >>> old = [
        >>>     [20, 21, 22, 23], [1, 2], [12], [13, 14], [3, 4], [5, 6,11],
        >>>     [7], [8, 9], [10], [31, 32], [33, 34, 35], [41, 42, 43, 44, 45]
        >>> ]
        >>> new = [
        >>>   [20, 21], [22, 23], [1, 2], [12, 13, 14], [4], [5, 6, 3], [7, 8],
        >>>   [9, 10, 11], [31, 32, 33, 34, 35],   [41, 42, 43, 44], [45],
        >>> ]
        >>> df = ut.grouping_delta_stats(old, new)
        >>> print(df)

def grouping_delta_stats(old, new):
    """
    Returns statistics about grouping changes

    Args:
        old (set of frozenset): old grouping
        new (set of frozenset): new grouping

    Returns:
        pd.DataFrame: df: data frame of size statistics

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_alg import *  # NOQA
        >>> import utool as ut
        >>> old = [
        >>>     [20, 21, 22, 23], [1, 2], [12], [13, 14], [3, 4], [5, 6,11],
        >>>     [7], [8, 9], [10], [31, 32], [33, 34, 35], [41, 42, 43, 44, 45]
        >>> ]
        >>> new = [
        >>>   [20, 21], [22, 23], [1, 2], [12, 13, 14], [4], [5, 6, 3], [7, 8],
        >>>   [9, 10, 11], [31, 32, 33, 34, 35],   [41, 42, 43, 44], [45],
        >>> ]
        >>> df = ut.grouping_delta_stats(old, new)
        >>> print(df)
    """
    import pandas as pd
    import utool as ut
    group_delta = ut.grouping_delta(old, new)
    stats = ut.odict()
    unchanged = group_delta['unchanged']
    splits = group_delta['splits']
    merges = group_delta['merges']
    hybrid = group_delta['hybrid']
    statsmap = ut.partial(lambda x: ut.stats_dict(map(len, x), size=True))
    stats['unchanged'] = statsmap(unchanged)
    stats['old_split'] = statsmap(splits['old'])
    stats['new_split'] = statsmap(ut.flatten(splits['new']))
    stats['old_merge'] = statsmap(ut.flatten(merges['old']))
    stats['new_merge'] = statsmap(merges['new'])
    stats['old_hybrid'] = statsmap(hybrid['old'])
    stats['new_hybrid'] = statsmap(hybrid['new'])
    df = pd.DataFrame.from_dict(stats, orient='index')
    df = df.loc[list(stats.keys())]
    return df