ValueError Traceback most recent call lastCell In18 line 14 12 # 使用K-means算法进行聚类 13 kmeans = KMeansn_clusters=3 init=random--- 14 kmeansfitdata 15 labels = k
The error message indicates that the input data contains NaN (Not a Number) values, which cannot be processed by the KMeans algorithm. To fix this error, you need to either remove the rows or columns that contain NaN values or impute (fill in) the missing values with a suitable method before passing the data to the KMeans algorithm. You can use the SimpleImputer class from scikit-learn to impute the missing values.
原文地址: https://www.cveoy.top/t/topic/hhub 著作权归作者所有。请勿转载和采集!