import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import zscore

file = 'https://raw.githubusercontent.com/grbruns/cst383/master/winequality-red.csv'
df = pd.read_csv(file, sep=';')
# don't use quality
df.drop('quality', axis=1, inplace=True)
# scale the data
df = df.apply(zscore)

X = df.iloc[:,:5].values

kmeans = KMeans(n_clusters=k)
kmeans.fit(X)
pca = PCA(n_components=2)
X2D = pca.fit_transform(X)
sns.scatterplot(x=X2D[:,0], y=X2D[:,1], hue=kmeans.labels_)
plt.xlabel('PC1')
plt.ylabel('PC2')
