baybe.utils.augmentation.df_apply_permutation_augmentation¶
- baybe.utils.augmentation.df_apply_permutation_augmentation(df: DataFrame, column_groups: Sequence[Sequence[str]])[source]¶
Augment a dataframe if permutation invariant columns are present.
- Parameters:
- Return type:
- Returns:
The augmented dataframe containing the original one. Augmented row indices are identical with the index of their original row.
- Raises:
ValueError – If less than two column groups are given.
ValueError – If a column group is empty.
ValueError – If the column groups have differing amounts of entries.
Examples
>>> df = pd.DataFrame({'A1':[1,2],'A2':[3,4], 'B1': [5, 6], 'B2': [7, 8]}) >>> df A1 A2 B1 B2 0 1 3 5 7 1 2 4 6 8
>>> column_groups = [['A1'], ['A2']] >>> dfa = df_apply_permutation_augmentation(df, column_groups) >>> dfa A1 A2 B1 B2 0 1 3 5 7 0 3 1 5 7 1 2 4 6 8 1 4 2 6 8
>>> column_groups = [['A1', 'B1'], ['A2', 'B2']] >>> dfa = df_apply_permutation_augmentation(df, column_groups) >>> dfa A1 A2 B1 B2 0 1 3 5 7 0 3 1 7 5 1 2 4 6 8 1 4 2 8 6