我正在尝试使用matplotlib.pyplot.scatter()绘制数据。散点图的争论之一是数据给了我的数据帧 这样data = df [df ['Index'] == 1] 索引是我的数据框中的一列,其中包含整数值0、1、2、3、4、5。 但是我得到ValueError:系列的真值是模棱两可的。使用a.empty,a.bool(),a.item(),a.any()或a.all()。
我使用了pd.DataFrame(df [df ['Index'] == 1]),效果很好。
a=df[df['Index']==2]
print(a)
spring = plt.scatter(df.Height,df.Weight,data=df.query('Index ==
'1'),marker='o',color='green',label="spring")