Last active
February 22, 2021 07:45
-
-
Save makispl/aa6135175e75257d20fd46f11277963a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instantiate a KMeans model with 3 clusters, fit and predict cluster indices | |
kmeans = KMeans(n_clusters=3, init='k-means++', random_state=1) | |
kmeans.fit_predict(data) | |
df_no_nuls['cluster'] = kmeans.labels_ | |
data['cluster'] = kmeans.labels_ | |
df_no_nuls.cluster.value_counts() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment