Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #scale #features #dataframe
ADD COMMENT
Topic
Name
1+9 =