Skip to content

Instantly share code, notes, and snippets.

@tiaplagata
Created October 9, 2020 16:07
Show Gist options
  • Save tiaplagata/77b3eb6a9c7a8a9e1c05cc7958c914bc to your computer and use it in GitHub Desktop.
Save tiaplagata/77b3eb6a9c7a8a9e1c05cc7958c914bc to your computer and use it in GitHub Desktop.
Standard Normalize Features for Linear Regression
# Write function to standard normalize one feature
def std_normalize_feature(feature):
"""
input a feature column name
returns series of normalized feature values
"""
return (feature - feature.mean()) / feature.std()
# Apply function to our previous log_df
df_log_normal = df_log.apply(std_normalize_feature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment