convert (values, counts) as returned by aggregate.aggregate_counts() to dicts
    makes expand_counts much faster

def counts_to_dicts(df, column):
    """
    convert (values, counts) as returned by aggregate.aggregate_counts() to dicts
    makes expand_counts much faster
    """
    # index where there are counts and they aren't null
    d = df[column].apply(lambda c: pd.notnull(c) and len(c[0]) > 0)
    return df.loc[d, column].apply(lambda c: {k: v for k, v in zip(*c)})