def compute_pct_by_group(df, group_col='group', value_col='count'):
    """
    Determine what percent each element contributes to its group's total.
      - Sum value by group to get group totals
      - Divide each group element by its group's total to get fraction of group
      - Multiply by 100 to get percent of group for each group element
      - Return series with percent-of-group values
    http://pbpython.com/pandas_transform.html
    """
    total = df.groupby(group_col)[value_col].transform('sum')
    return df[value_col] / total * 100.