clarite.modify.move_variables

clarite.modify.move_variables(left: pandas.core.frame.DataFrame, right: pandas.core.frame.DataFrame, skip: Union[str, List[str], NoneType] = None, only: Union[str, List[str], NoneType] = None)

Move one or more variables from one DataFrame to another

Parameters:
left: pd.Dataframe

DataFrame containing the variable(s) to be moved

right: pd.DataFrame

DataFrame (which uses the same index) that the variable(s) will be moved to

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

List of variables that will not be moved

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

List of variables that are the only ones to be moved

Returns:
left: pd.DataFrame

The first DataFrame with the variables removed

right: pd.DataFrame

The second DataFrame with the variables added

Examples

>>> import clarite
>>> df_cat, df_cont = clarity.modify.move_variables(df_cat, df_cont, only=["DRD350AQ", "DRD350DQ", "DRD350GQ"])
Moved 3 variables.
>>> discovery_check, discovery_cont = clarite.modify.move_variables(discovery_check, discovery_cont)
Moved 39 variables.