app/package/model_pkg/conversion_rate_model/model_template.py
def data_preparation(df: pd.DataFrame,
                     target_col='cr',
                     cols_to_drop=['entity_id']) -> Tuple[pd.DataFrame,
                                                          pd.Series,
                                                          str]:
    """Function to align data with the model requirements

    Args:
        df: input data frame
        target_col: target column name
        cols_to_drop: additional list of columns to drop

    Returns:
        tuple of the features DataFrame, 
                  target column 
                  and the error message text            
    """
    try:
        if target_col is None:
            return df.drop(cols_to_drop, axis=1), None, None
        return df.drop([*cols_to_drop, *[target_col]], axis=1), df[target_col], None

    except Exception as ex:
        return None, None, ex
Function to align data with the model requirements

    Args:
        df: input data frame
        target_col: target column name
        cols_to_drop: additional list of columns to drop

    Returns:
        tuple of the features DataFrame, 
                  target column 
                  and the error message text            
    
Function to align data with the model requirements
Function to align data with the model requirements
def data_preparation(df: pd.DataFrame,
                     target_col='cr',
                     cols_to_drop=['entity_id']) -> Tuple[pd.DataFrame,
                                                          pd.Series,
                                                          str]:
    try:
        if target_col is None:
            return df.drop(cols_to_drop, axis=1), None, None
        return df.drop([*cols_to_drop, *[target_col]], axis=1), df[target_col], None
    except Exception as ex:
        return None, None, ex
def data_preparation ( df : pd . DataFrame , target_col = 'cr' , cols_to_drop = [ 'entity_id' ] ) -> Tuple [ pd . DataFrame , pd . Series , str ] : try : if target_col is None : return df . drop ( cols_to_drop , axis = 1 ) , None , None return df . drop ( [ * cols_to_drop , * [ target_col ] ] , axis = 1 ) , df [ target_col ] , None except Exception as ex : return None , None , ex
Function to align data with the model requirements
Function to align data with the model requirements
"""Function to align data with the model requirements

    Args:
        df: input data frame
        target_col: target column name
        cols_to_drop: additional list of columns to drop

    Returns:
        tuple of the features DataFrame, 
                  target column 
                  and the error message text            
    """
tuple of the features DataFrame,
target column
and the error message text
tuple of the features DataFrame target column and the error message text
df
pd.DataFrame
input data frame
input data frame
target_col
target column name
target column name
cols_to_drop
additional list of columns to drop
additional list of columns to drop