用 dataframe.plot 绘图时坐标设置相关的问题,麻烦各位帮忙看看,谢谢

2019-03-25 23:11:47 +08:00
 yellowtail
把价格按指数平均化以后按序列绘图。。。
https://imgchr.com/i/AtzRTH
把新的 dataframe 的 index 改变为时间序列,但是发现画图坐标轴直接显示为 5 了。。
https://imgchr.com/i/Atz20e

感觉这些莫名其妙的问题好打击人
3432 次点击
所在节点    Python
3 条回复
necomancer
2019-03-26 00:50:14 +08:00
df.set_index(pd.to_datetime(df[5])).plot()
或者 df2.index=pd.to_datetime(df[5])
检查一下 dtype,你需要转换成时间,字符串不行的。
necomancer
2019-03-26 00:52:41 +08:00
或者 df = df.set_index(pd.to_datetime(df[5]))
再 df['ema'].plot()
yellowtail
2019-03-26 19:07:54 +08:00
@necomancer 已解决,谢谢

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/548501

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX