Professional Documents
Culture Documents
PythonCode DemandPoints KMeans
PythonCode DemandPoints KMeans
import pandas as pd
location_df = pd.read_csv( "LogLatData.csv" )
location_df
#K-means Clustering
from sklearn.cluster import KMeans
clusters_new = KMeans( 3)
clusters_new.fit( new_location_df )
new_location_df["clusterid"] = clusters_new.labels_
new_location_df