Skip to content

Instantly share code, notes, and snippets.

Created May 5, 2021
What would you like to do?
df = data.copy()
scaler = StandardScaler()
x = scaler.fit_transform(df)
kmeans = KMeans(5)
labels = kmeans.labels_
clusters = pd.concat([data, pd.DataFrame({"Cluster": labels})], axis=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment