openclean.operator.transform.apply module

Apply operator for data frames.

class openclean.operator.transform.apply.Apply(columns, func)

Bases: openclean.operator.base.DataFrameTransformer

Apply function for data frames. Returns a modified data frame where values in the specified columns have been modified using the given apply function.

The apply function can be an apply factory. In this case, a separate instance of the function is generated and applied to each column.

transform(df)

Return a data frame where all values in the specified columns have been modified by the apply function.

Parameters

df (pandas.DataFrame) – Input data frame.

Return type

pandas.DataFrame

openclean.operator.transform.apply.apply(df, columns, func)

Apply function for data frames. Returns a modified data frame where values in the specified columns have been modified using the given apply function.

The apply function can be an apply factory. In this case, a separate instance of the function is generated and applied to each column.

Parameters
  • df (pandas.DataFrame) – Input data frame.

  • columns (int, string, or list(int or string), optional) – Single column or list of column index positions or column names.

  • func (callable or openclean.function.eval.base.ApplyFactory) – Callable that accepts a single value or a fatory that creates such a callable.

Return type

pandas.DataFrame