def split_df_to_train_test(df, train_frac):
    """Divides the data into a training and test set, in order."""
    sessions = df.session_id.unique()
    sess_size = len(sessions)
    sess_size_train = int(sess_size * train_frac)
    sessions = sessions[:sess_size_train]
    train = df[df.session_id.isin(sessions)]
    test = df[~df.session_id.isin(sessions)]
    del df
    print(f'Splitted result: train {len(train)} lines, test {len(test)} lines')
    print(f'Splitted result: train {sess_size_train} sessions, test {sess_size - sess_size_train} sessions')
    return train, test