Skip to content

Instantly share code, notes, and snippets.

@fk-pixel
Last active August 17, 2020 13:12
Show Gist options
  • Save fk-pixel/925bf26138114556b47fcd65701a9a86 to your computer and use it in GitHub Desktop.
Save fk-pixel/925bf26138114556b47fcd65701a9a86 to your computer and use it in GitHub Desktop.
Distribute in 5 Clusters
#Distribute in 5 Clusters
# set number of clusters
kclusters = 5
manchester_grouped_clustering = manchester_grouped.drop('Street', 1)
# run k-means clustering
kmeans = KMeans(n_clusters=kclusters, random_state=0).fit(manchester_grouped_clustering)
# check cluster labels generated for each row in the dataframe
kmeans.labels_[0:50]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment