clarite.modify.transform

clarite.modify.transform(data:pandas.core.frame.DataFrame, transform_method:str, skip:Union[str, List[str], NoneType]=None, only:Union[str, List[str], NoneType]=None)

Apply a transformation function to a variable

Parameters
data: pd.DataFrame or pd.Series

Data to be processed

transform_method: str

Name of the transformation (Python function or NumPy ufunc to apply)

skip: str, list or None (default is None)

List of variables that will not be transformed

only: str, list or None (default is None)

List of variables that are the only ones to be transformed

Returns
data: pd.DataFrame

DataFrame with variables that have been transformed

Examples

>>> import clarite
>>> df = clarite.modify.transform(df, 'log', only=['BMXBMI'])
================================================================================
Running transform
--------------------------------------------------------------------------------
Transformed 'BMXBMI' using 'log'.