Skip to content

Instantly share code, notes, and snippets.

@kxzk
Created August 9, 2019 21:38
Show Gist options
  • Save kxzk/3fe3a7dcaabd82a350807808598d7366 to your computer and use it in GitHub Desktop.
Save kxzk/3fe3a7dcaabd82a350807808598d7366 to your computer and use it in GitHub Desktop.
# For positive data with no zeroes
np.log(df["sales"])
# For positive data with zeroes
np.log1p(df["sales"])
# Convert back - get predictions if target is log transformed
np.expm1(df["sales"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment