vak.prep.dataset_df_helper.add_split_col#

vak.prep.dataset_df_helper.add_split_col(df: DataFrame, split: str) DataFrame[source]#

Add a ‘split’ column to a pandas DataFrame.

Used by vak.prep() to assign an entire dataset to the same split, e.g. ‘train’ or ‘predict’. All rows in the ‘split’ column will have the value specified.

Parameters:
  • df (pandas.DataFrame) – A dataframe that represents a dataset.

  • split (str) – A string that will be assigned to every row in the added “split” column. One of {‘train’, ‘val’, ‘test’, ‘predict’}.