Skip to content

Instantly share code, notes, and snippets.

@tiaplagata
Created October 9, 2020 15:57
Show Gist options
  • Save tiaplagata/9082274f6eb15000d9694f5b699ece20 to your computer and use it in GitHub Desktop.
Save tiaplagata/9082274f6eb15000d9694f5b699ece20 to your computer and use it in GitHub Desktop.
Log Transformation of Target Feature in Linear Model
# Our main dataframe is df
continuous = ['price', 'sqft_living', 'sqft_lot', 'sqft_living15', 'sqft_lot15']
df_log = df[continuous]
# Create column names that indicate a log ex. 'price_log'
log_names = [f'{column}_log' for column in df_log.columns]
df_log = np.log10(df_log)
df_log.columns = log_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment