ax = df_seeds_train [df_seeds_train ['cluster'] == 0] .plot(种类='散布',x ='不对称',y ='周长',s = 50,c ='绿色',sharex =假) df_seeds_train [df_seeds_train ['cluster'] == 1] .plot(kind ='scatter',x ='asymmetry',y ='perimeter',s = 50,c ='orange',sharex = False,ax = ax ) df_seeds_train [df_seeds_train ['cluster'] == 2] .plot(kind ='scatter',x ='asymmetry',y ='perimeter',s = 50,c ='purple',sharex = False,ax = ax )
centers.plot(kind = 'scatter', x='asymmetry', y='perimeter', c='red', s=50, marker='x', sharex=False, ax=ax)
我需要在群集的中心获得红色标记,但我不断收到“不对称”和“过时”的KeyErrors。有谁知道如何解决这个问题。我添加了我现在得到的结果的图像。Outcome
提前谢谢! df_seeds_train