def drop_labels(events, min_pct):
    """
    Advances in Financial Machine Learning, Snippet 3.8 pg. 64.

    Drops labels that are underpopulated

    :param events: (pd.Series) Value of events calculated (symmetric CUSUM filter)
    :min_pct: (float) Drops the lowest min_pct of the labels

    :return: (pd.Series) Events with the bottom min_pct labels removed
    """
    while True:
        df = events['bin'].value_counts(normalize=True)

        if df.min() > min_pct or df.shape[0] < 3:
            break

        print('dropped label', df.argmin(), df.min())

        events = events[events['bin'] != df.argmin()]

    return events