Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created November 12, 2020 12:15
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 yuyasugano/7365cef2e8a727502683f7c9e0df0b4a to your computer and use it in GitHub Desktop.
Save yuyasugano/7365cef2e8a727502683f7c9e0df0b4a to your computer and use it in GitHub Desktop.
What are standarization and normalization? Test with iris data set in Scikit-learn
# apply StandardScaler for iris data set, this is z-score normalization
from sklearn.preprocessing import StandardScaler
df_s = df.copy()
std_scaler = StandardScaler()
df_s.iloc[:, [0, 1, 2, 3]] = std_scaler.fit_transform(df_s.iloc[:, [0, 1, 2, 3]])
df_s.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment