Skip to content

Instantly share code, notes, and snippets.

Created May 5, 2021
What would you like to do?
colors = {0:"red", 1:"yellow", 2:"blue", 3:"green", 4:"pink"}
pca = PCA()
principal_components = pca.fit_transform(x)
x, y = principal_components[:,0], principal_components[:,1]
df = pd.DataFrame({"X": x, "Y": y, "Labels": labels})
groups = df.groupby(labels)
fig, ax = plt.subplots(figsize=(15, 10))
for i, j in groups:
ax.plot(j.X, j.Y, marker='o', linestyle='', ms=5, color=colors[i], mec='none')
ax.tick_params(axis= 'y',which='both',left='off',top='off',labelleft='off')
ax.set_title("Credit Card Customer Segmentation")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment