Skip to content

Instantly share code, notes, and snippets.

@Wann-Jiun
Created January 19, 2017 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wann-Jiun/f98a8990418eb378b5d4eca632ea0d1c to your computer and use it in GitHub Desktop.
Save Wann-Jiun/f98a8990418eb378b5d4eca632ea0d1c to your computer and use it in GitHub Desktop.
from scipy.stats import skew
skewed_features = train_df[numerical_features].apply(lambda x: skew(x.dropna().astype(float)))
skewed_features = skewed_features[skewed_features > 0.75]
skewed_features = skewed_features.index
train_df[skewed_features] = np.log1p(train_df[skewed_features])
test_df[skewed_features] = np.log1p(test_df[skewed_features])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment