这个问题在这里已经有了答案:
Scatter plot form dataframe with index on x-axis
(2 个回答)
2年前关闭。
我正在尝试从 Pandas 数据帧创建散点图,但我不想使用 matplotlib plt。以下是脚本
df:
group people value
1 5 100
2 2 90
1 10 80
2 20 40
1 7 10
我想在 x 轴上创建一个带有索引的散点图,只使用 Pandas 数据框
df.plot.scatter(x = df.index, y = df.value)
它给了我一个错误
Int64Index([0, 1, 2, 3, 4], dtype='int64') not in index
我不想使用
plt.scatter(x = df.index, y = df.value)
如何使用 Pandas 数据框执行此图
最佳答案
关于python - Pandas 图 : scatter plot with index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55169540/