from scipy.spatial import Voronoi, voronoi_plot_2d
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
location1="XXX"
df = pd.read_csv(location1, encoding = "ISO-8859-1")
#Run kmeans clustering
X = df ['long','lat' » ].values #~2k locations in the UK
y=df 'label' » .values #Label is a 0 or 1
kmeans = KMeans(n_clusters=30, random_state=0).fit(X, y)
centers=kmeans.cluster_centers_
plt.scatter(centers :,0 » ,centers :,1 » , marker='s', s=100)
vor = Voronoi(centers)
fig = voronoi_plot_2d(vor,plt.gca())
plt.show()