V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
yellowtail
V2EX  ›  Python

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

  •  
  •   yellowtail · 2019-03-25 23:11:47 +08:00 · 3429 次点击
    这是一个创建于 1856 天前的主题,其中的信息可能已经有所发展或是发生改变。
    把价格按指数平均化以后按序列绘图。。。
    https://imgchr.com/i/AtzRTH
    把新的 dataframe 的 index 改变为时间序列,但是发现画图坐标轴直接显示为 5 了。。
    https://imgchr.com/i/Atz20e

    感觉这些莫名其妙的问题好打击人
    necomancer
        1
    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
        2
    necomancer  
       2019-03-26 00:52:41 +08:00   ❤️ 1
    或者 df = df.set_index(pd.to_datetime(df[5]))
    再 df['ema'].plot()
    yellowtail
        3
    yellowtail  
    OP
       2019-03-26 19:07:54 +08:00
    @necomancer 已解决,谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1123 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:41 · PVG 06:41 · LAX 15:41 · JFK 18:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.