baybe.utils.dataframe.get_transform_objects¶
- baybe.utils.dataframe.get_transform_objects(df: DataFrame, objects: Sequence[_T], /, *, allow_missing: bool = False, allow_extra: bool = False)[source]¶
Extract the objects relevant for transforming a given dataframe.
The passed objects are assumed to have corresponding columns in the given dataframe, identified through their name attribute. The function returns the subset of objects that have a corresponding column in the dataframe and thus provide the necessary information for transforming the dataframe.
- Parameters:
df (
DataFrame
) – The dataframe to be searched for corresponding columns.objects (
Sequence
[TypeVar
(_T
, bound=Parameter
|Target
)]) – A collection of objects to be considered for transformation (provided they have a match in the given dataframe).allow_missing (
bool
) – Flag controlling if objects are allowed to have no corresponding columns in the dataframe.allow_extra (
bool
) – Flag controlling if the dataframe is allowed to have columns that have no corresponding objects.
- Raises:
ValueError – If the given objects and dataframe are not compatible under the specified values for the Boolean flags.
- Return type:
- Returns:
The (subset of) objects that need to be considered for the transformation.