def proportional_abundance(weblog_tmp, field):
    """
    Calculate proportion of each sub-field in field columns
    """
    weblog_tmp = weblog_tmp.copy(deep=True)
    if weblog_tmp.shape[0] == 0:
        raise AssertionError('Empty weblog.')
    histogram = weblog_tmp[field].value_counts()
    pa_df = histogram / histogram.values.sum()
    if abs(1.0 - pa_df.values.sum()) > 1e-08:
        raise AssertionError(
            'ERROR: Proportional abundance distribution does not sum up to one.'
            )
    return pa_df.values, list(pa_df.index)
