import random


def filter_random_values(n, df, col_name):
    """
    Filter randomly chosen part of DataFrame.
    :param n: Sample size
    :param df: Pandas DataFrame.
    :param col_name: DataFrame column name
    :return filtered DataFrame
    """
    # check if sample size is lower than 1
    assert n < 1
    # list of unique values in column col_name
    val_list = list(df[col_name].unique())
    # randomly choose part of DataFrame
    chosen_val = random.sample(val_list, int(n * len(val_list)))
    return df[df[col_name].isin(chosen_val)]