import from sklearn.preprocessing import MinMaxScaler from sklearn.cluster import KMeans from sklearn.metrics import silhouette_score MinMax Scaler scaler = MinMaxScaler() df_res_scaler = scaler.fit_transform(df_res) Kmeans & silhouette_score model = KMeans(n_clusters=k) model.fit_transform(df_res_scaler) model.labels_ sil = silhouette_score(df_res_scaler, model.labels_) sil.round(2)