def select_n_subjects(df, n):
    """ Returns the first n subjects from df.
        :param df Dataframe with responses
        :param n Number of subjects to select
        :return: dataframe with selected subjects.
    """
    #get ordered number of subjects
    subj_ids = sorted(list(set(df["sub"])))
    selected = subj_ids[:n]
    #select first n
    df= df.loc[df["sub"].isin(selected)]
    return df