Skip to content

Instantly share code, notes, and snippets.

@jurand71
Created July 3, 2022 05:32
Show Gist options
  • Save jurand71/a72575aea65533ce84659149d53a09d2 to your computer and use it in GitHub Desktop.
Save jurand71/a72575aea65533ce84659149d53a09d2 to your computer and use it in GitHub Desktop.
transformer = PowerTransformer(method='box-cox', standardize=False)
# first find the optimal lambda using the train set
transformer.fit(df[variables].fillna(1))
transformed_var = transformer.transform(df[variables].fillna(1))
transformed_var = pd.DataFrame(transformed_var, columns = variables)
Gaussian_distribution_check(df, "YearBuilt" )
Gaussian_distribution_check(transformed_var, "YearBuilt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment