from sklearn.cluster import KMeans
for key, value in points_dict.items():
# x = np.mean([point[0] for point in value])
#设置聚类数量为1
kmeans = KMeans(n_clusters=1)
kmeans.fit(value)
#获取聚类后的中心坐标点
center_points = kmeans.cluster_centers_
points_dict[key] = center_points
return points_dict
08-10
561
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-23
1377
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-16
3676
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)