来自Pandas图的错误图表

时间:2016-03-18 16:22:18

标签: pandas plot

有人可以解释为什么pandas图中的图表不会显示数据框中的任何数字吗?

b = df_trend.ask[:10]
print b
0     100.86
2     100.85
3     100.84
4     100.84
5     100.85
7     100.85
9     100.85
11    100.84
12    100.85
14    100.85
Name: ask, dtype: float64

使用绘图方法输出图形如下所示

b.plot()

enter image description here

2 个答案:

答案 0 :(得分:0)

由于一些奇怪的原因,大熊猫认为100.xx是大数?将偏移设置为False解决了问题。

Wrong value in matplotlib yticks

答案 1 :(得分:0)

pandas正确显示所有内容 - 如果指定ylim参数:

,则可以看到它
df.plot(ylim=(100.8, 100.9))

如果您想禁用科学记数法:

ax = df.plot(ylim=(100.8, 100.9))
ax.get_yaxis().get_major_formatter().set_useOffset(False)

plt.show()

enter image description here