src/syndp/utils/preprocessing.py
def dummify(data : pd.DataFrame, columns= None, prefix_separator = "-"):
    '''
    dummifing function
    data : original data with categorical and continuous variables
    prefix_sep  mostly uses '_' as prefix separator. Can be modified
    columns : list of columns that are categorical
    '''
    excluded_variables = [continuous for continuous in data.columns if continuous not in columns]
    data1 = data[excluded_variables].copy() # we will concat this data with the dummified data
    
    list_of_series = [data[cols] for cols in columns]
    dummified = list(map(lambda x, y : pd.get_dummies(data=y, prefix=x, prefix_sep=prefix_separator), columns, list_of_series))
    
    dummified = pd.concat([data1, *dummified], axis=1)
    
    return dummified

    dummifing function
    data : original data with categorical and continuous variables
    prefix_sep  mostly uses '_' as prefix separator. Can be modified
    columns : list of columns that are categorical
    
dummifing function
data : original data with categorical and continuous variables
prefix_sep  mostly uses '_' as prefix separator. Can be modified
columns : list of columns that are categorical
dummifing function data : original data with categorical and continuous variables prefix_sep mostly uses ' _ ' as prefix separator . Can be modified columns : list of columns that are categorical
def dummify(data : pd.DataFrame, columns= None, prefix_separator = "-"):
    excluded_variables = [continuous for continuous in data.columns if continuous not in columns]
    data1 = data[excluded_variables].copy() 
    list_of_series = [data[cols] for cols in columns]
    dummified = list(map(lambda x, y : pd.get_dummies(data=y, prefix=x, prefix_sep=prefix_separator), columns, list_of_series))
    dummified = pd.concat([data1, *dummified], axis=1)
    return dummified
def dummify ( data : pd . DataFrame , columns = None , prefix_separator = "-" ) : excluded_variables = [ continuous for continuous in data . columns if continuous not in columns ] data1 = data [ excluded_variables ] . copy ( ) list_of_series = [ data [ cols ] for cols in columns ] dummified = list ( map ( lambda x , y : pd . get_dummies ( data = y , prefix = x , prefix_sep = prefix_separator ) , columns , list_of_series ) ) dummified = pd . concat ( [ data1 , * dummified ] , axis = 1 ) return dummified
dummifing function
data : original data with categorical and continuous variables
prefix_sep  mostly uses '_' as prefix separator.
dummifing function data : original data with categorical and continuous variables prefix_sep mostly uses ' _ ' as prefix separator .
'''
    dummifing function
    data : original data with categorical and continuous variables
    prefix_sep  mostly uses '_' as prefix separator. Can be modified
    columns : list of columns that are categorical
    ''' # we will concat this data with the dummified data
data
pd.DataFrame
columns
prefix_separator