def pareto_rule(data, default='otros'):
    """Implementation of Pareto rule to categorical variable.

    "80% of outputs are produced by 20% of inputs"

    Parameters
    ---------
    data: pandas.Series
        categorical variable to map Pareto rule
    default: str
        value to group tail values of data.

    Returns
    ------
    mapped: pandas.Series

    """
    zn_dominante = data.value_counts().cumsum() / data.shape[0]
    zn_select = zn_dominante[zn_dominante < 0.8].index.tolist()
    map_barrio = dict(zip(zn_select, zn_select))
    mapped = data.map(lambda x: map_barrio.get(x, default))

    return mapped