churn_library.py
def perform_feature_engineering(data_df, response='Churn'):
    '''
    input:
        data_df: pandas dataframe
        response: string of response name [optional argument that could
              be used for naming variables or index y column]

    output:
        x_train: X training data
        x_test: X testing data
        y_train: y training data
        y_test: y testing data
    '''

    columns_to_encode = ['Gender', 'Education_Level', 'Marital_Status',
                         'Income_Category', 'Card_Category']

    data_df = encoder_helper(data_df, columns_to_encode, response)

    keep_cols = [
        'Customer_Age',
        'Dependent_count',
        'Months_on_book',
        'Total_Relationship_Count',
        'Months_Inactive_12_mon',
        'Contacts_Count_12_mon',
        'Credit_Limit',
        'Total_Revolving_Bal',
        'Avg_Open_To_Buy',
        'Total_Amt_Chng_Q4_Q1',
        'Total_Trans_Amt',
        'Total_Trans_Ct',
        'Total_Ct_Chng_Q4_Q1',
        'Avg_Utilization_Ratio',
        'Gender_Churn',
        'Education_Level_Churn',
        'Marital_Status_Churn',
        'Income_Category_Churn',
        'Card_Category_Churn']

    data = pd.DataFrame()
    data[keep_cols] = data_df[keep_cols]
    labels = data_df['Churn']

    x_train, x_test, y_train, y_test = train_test_split(
        data, labels, test_size=0.3, random_state=42)

    return x_train, x_test, y_train, y_test

    input:
        data_df: pandas dataframe
        response: string of response name [optional argument that could
              be used for naming variables or index y column]

    output:
        x_train: X training data
        x_test: X testing data
        y_train: y training data
        y_test: y testing data
    
pandas dataframe
response: string of response name [optional argument that could
be used for naming variables or index y column]


pandas dataframe response : string of response name [ optional argument that could be used for naming variables or index y column ]
def perform_feature_engineering(data_df, response='Churn'):
    columns_to_encode = ['Gender', 'Education_Level', 'Marital_Status',
                         'Income_Category', 'Card_Category']
    data_df = encoder_helper(data_df, columns_to_encode, response)
    keep_cols = [
        'Customer_Age',
        'Dependent_count',
        'Months_on_book',
        'Total_Relationship_Count',
        'Months_Inactive_12_mon',
        'Contacts_Count_12_mon',
        'Credit_Limit',
        'Total_Revolving_Bal',
        'Avg_Open_To_Buy',
        'Total_Amt_Chng_Q4_Q1',
        'Total_Trans_Amt',
        'Total_Trans_Ct',
        'Total_Ct_Chng_Q4_Q1',
        'Avg_Utilization_Ratio',
        'Gender_Churn',
        'Education_Level_Churn',
        'Marital_Status_Churn',
        'Income_Category_Churn',
        'Card_Category_Churn']
    data = pd.DataFrame()
    data[keep_cols] = data_df[keep_cols]
    labels = data_df['Churn']
    x_train, x_test, y_train, y_test = train_test_split(
        data, labels, test_size=0.3, random_state=42)
    return x_train, x_test, y_train, y_test
def perform_feature_engineering ( data_df , response = 'Churn' ) : columns_to_encode = [ 'Gender' , 'Education_Level' , 'Marital_Status' , 'Income_Category' , 'Card_Category' ] data_df = encoder_helper ( data_df , columns_to_encode , response ) keep_cols = [ 'Customer_Age' , 'Dependent_count' , 'Months_on_book' , 'Total_Relationship_Count' , 'Months_Inactive_12_mon' , 'Contacts_Count_12_mon' , 'Credit_Limit' , 'Total_Revolving_Bal' , 'Avg_Open_To_Buy' , 'Total_Amt_Chng_Q4_Q1' , 'Total_Trans_Amt' , 'Total_Trans_Ct' , 'Total_Ct_Chng_Q4_Q1' , 'Avg_Utilization_Ratio' , 'Gender_Churn' , 'Education_Level_Churn' , 'Marital_Status_Churn' , 'Income_Category_Churn' , 'Card_Category_Churn' ] data = pd . DataFrame ( ) data [ keep_cols ] = data_df [ keep_cols ] labels = data_df [ 'Churn' ] x_train , x_test , y_train , y_test = train_test_split ( data , labels , test_size = 0.3 , random_state = 42 ) return x_train , x_test , y_train , y_test
input:
data_df: pandas dataframe
response: string of response name [optional argument that could
be used for naming variables or index y column]
input : data_df : pandas dataframe response : string of response name [ optional argument that could be used for naming variables or index y column ]
'''
    input:
        data_df: pandas dataframe
        response: string of response name [optional argument that could
              be used for naming variables or index y column]

    output:
        x_train: X training data
        x_test: X testing data
        y_train: y training data
        y_test: y testing data
    '''
data_df
response