Last active
September 28, 2019 18:49
-
-
Save vanessaaleung/93956a83bbf60eea7fa7bab4bc31131e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from sklearn.cluster import KMeans | |
# set number of clusters | |
kclusters = 5 | |
sf_grouped_clustering = sf_grouped.drop('Neighborhood', 1) | |
# run k-means clustering | |
kmeans = KMeans(n_clusters = kclusters, random_state = 0).fit(sf_grouped_clustering) | |
# check cluster labels generated for each row in the dataframe | |
kmeans.labels_[0:10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment