utils.py
def cal_numerical(target_df_1, numeric_feature, numerical_df):
    '''
    Calculate metrices for numerical features
        including counts, missing values, Median and MAD, range/scaling
    '''

    # get counts of non NA values
    count_log = target_df_1[numeric_feature].count()
    numerical_df.loc[numeric_feature, 'count'] = count_log

    # get missing value counts
    missing_count_log = target_df_1[numeric_feature].isna().sum()
    numerical_df.loc[numeric_feature, 'missing_count'] = missing_count_log

    # distribution
    # Median and MAD
    median_log = target_df_1[numeric_feature].median()
    numerical_df.loc[numeric_feature, 'median'] = median_log
    if missing_count_log == 0:
        mad_log = stats.median_absolute_deviation(target_df_1[numeric_feature])
        numerical_df.loc[numeric_feature, 'mad'] = mad_log
    else:
        numerical_df.loc[numeric_feature, 'mad'] = 0

    # range/ scaling
    range_log = target_df_1[numeric_feature].max() - target_df_1[numeric_feature].min()
    numerical_df.loc[numeric_feature, 'range'] = range_log

    return numerical_df

    Calculate metrices for numerical features
        including counts, missing values, Median and MAD, range/scaling
    
Calculate metrices for numerical features
including counts, missing values, Median and MAD, range/scaling
Calculate metrices for numerical features including counts missing values Median and MAD range / scaling
def cal_numerical(target_df_1, numeric_feature, numerical_df):
    count_log = target_df_1[numeric_feature].count()
    numerical_df.loc[numeric_feature, 'count'] = count_log
    missing_count_log = target_df_1[numeric_feature].isna().sum()
    numerical_df.loc[numeric_feature, 'missing_count'] = missing_count_log
    median_log = target_df_1[numeric_feature].median()
    numerical_df.loc[numeric_feature, 'median'] = median_log
    if missing_count_log == 0:
        mad_log = stats.median_absolute_deviation(target_df_1[numeric_feature])
        numerical_df.loc[numeric_feature, 'mad'] = mad_log
    else:
        numerical_df.loc[numeric_feature, 'mad'] = 0
    range_log = target_df_1[numeric_feature].max() - target_df_1[numeric_feature].min()
    numerical_df.loc[numeric_feature, 'range'] = range_log
    return numerical_df
def cal_numerical ( target_df_1 , numeric_feature , numerical_df ) : count_log = target_df_1 [ numeric_feature ] . count ( ) numerical_df . loc [ numeric_feature , 'count' ] = count_log missing_count_log = target_df_1 [ numeric_feature ] . isna ( ) . sum ( ) numerical_df . loc [ numeric_feature , 'missing_count' ] = missing_count_log median_log = target_df_1 [ numeric_feature ] . median ( ) numerical_df . loc [ numeric_feature , 'median' ] = median_log if missing_count_log == 0 : mad_log = stats . median_absolute_deviation ( target_df_1 [ numeric_feature ] ) numerical_df . loc [ numeric_feature , 'mad' ] = mad_log else : numerical_df . loc [ numeric_feature , 'mad' ] = 0 range_log = target_df_1 [ numeric_feature ] . max ( ) - target_df_1 [ numeric_feature ] . min ( ) numerical_df . loc [ numeric_feature , 'range' ] = range_log return numerical_df
Calculate metrices for numerical features
including counts, missing values, Median and MAD, range/scaling
Calculate metrices for numerical features including counts missing values Median and MAD range / scaling
'''
    Calculate metrices for numerical features
        including counts, missing values, Median and MAD, range/scaling
    ''' # get counts of non NA values # get missing value counts # distribution # Median and MAD # range/ scaling
target_df_1
numeric_feature
numerical_df