我想运行此代码,但显示“ str对象没有属性“ map””错误:
我不知道如何解决
clusters = KMeans.train(data, K, maxIterations=10, runs=10, initializationMode="random")
C:\opt\spark\spark-2.3.3-bin-hadoop2.6\python\pyspark\mllib\clustering.py
in train(cls, rdd, k, maxIterations, runs, initializationMode, seed, initializationSteps, epsilon, initialModel) 352 "to be of <type 'KMeansModel'>") 353 clusterInitialModel = [_convert_to_vector(c) for c in initialModel.clusterCenters] --> 354 model = callMLlibFunc("trainKMeansModel", rdd.map(_convert_to_vector), k, maxIterations, 355 runs, initializationMode, seed, initializationSteps, epsilon,