Answers for "function to scale features in dataframe"

-1

function to scale features in dataframe

# define a method to scale data, looping thru the columns, and passing a scaler
def scale_data(data, columns, scaler):
    for col in columns:
        data[col] = scaler.fit_transform(data[col].values.reshape(-1, 1))
    return data
Posted by: Guest on May-14-2020

Code answers related to "function to scale features in dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language