def train_test_split(df, frac):
    """Create a train/test split function for a data frame that returns both the
    training and test sets.  'frac' refers to the percent of data you would like
    to set aside for training"""
    cutoff = df.index < int(df.shape[0] * frac)
    df_train = df.loc[cutoff]
    df_test = df.loc[~cutoff]
    return df_train, df_test