(dfs, groupers)
return old, groupers
Align groupers to newly-diffed dataframes

    For groupby aggregations we keep historical values of the grouper along
    with historical values of the dataframes.  The dataframes are kept in
    historical sync with the ``diff_loc`` and ``diff_iloc`` functions above.
    This function copies that functionality over to the secondary list of
    groupers.
Align groupers to newly-diffed dataframes
Align groupers to newly - diffed dataframes
def diff_align(dfs, groupers):
    """ Align groupers to newly-diffed dataframes

    For groupby aggregations we keep historical values of the grouper along
    with historical values of the dataframes.  The dataframes are kept in
    historical sync with the ``diff_loc`` and ``diff_iloc`` functions above.
    This function copies that functionality over to the secondary list of
    groupers.
    """
    old = []
    while len(dfs) < len(groupers):
        old.append(groupers.popleft())

    if dfs:
        n = len(groupers[0]) - len(dfs[0])
        if n:
            old.append(groupers[0][:n])
            groupers[0] = groupers[0][n:]

    assert len(dfs) == len(groupers)
    for df, g in zip(dfs, groupers):
        assert len(df) == len(g)
    return old, groupers
def diff_align ( dfs , groupers ) : old = [ ] while len ( dfs ) < len ( groupers ) : old . append ( groupers . popleft ( ) ) if dfs : n = len ( groupers [ 0 ] ) - len ( dfs [ 0 ] ) if n : old . append ( groupers [ 0 ] [ : n ] ) groupers [ 0 ] = groupers [ 0 ] [ n : ] assert len ( dfs ) == len ( groupers ) for df , g in zip ( dfs , groupers ) : assert len ( df ) == len ( g ) return old , groupers