Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created January 10, 2018 17:40
Show Gist options
  • Save dipanjanS/6633de554e89783aef62aef4107793a4 to your computer and use it in GitHub Desktop.
Save dipanjanS/6633de554e89783aef62aef4107793a4 to your computer and use it in GitHub Desktop.
# Scaling attribute values to avoid few outiers
cols = ['density', 'residual sugar', 'total sulfur dioxide', 'fixed acidity']
subset_df = wines[cols]
from sklearn.preprocessing import StandardScaler
ss = StandardScaler()
scaled_df = ss.fit_transform(subset_df)
scaled_df = pd.DataFrame(scaled_df, columns=cols)
final_df = pd.concat([scaled_df, wines['wine_type']], axis=1)
final_df.head()
# plot parallel coordinates
from pandas.plotting import parallel_coordinates
pc = parallel_coordinates(final_df, 'wine_type', color=('#FFE888', '#FF9999'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment