def mse_to_roll(arr, Exp, ind):
    """Mean Squared Error used in the rolling function
    """
    temp = arr.value_counts(normalize=True).sort_index()
    if len(temp) < len(Exp):
        temp = temp.reindex(ind).fillna(0)
    return ((temp - Exp) ** 2).mean()
