推荐学习书目
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 · Mar 25, 2019 · 3905 views
    This topic created in 2609 days ago, the information mentioned may be changed or developed.
    把价格按指数平均化以后按序列绘图。。。
    https://imgchr.com/i/AtzRTH
    把新的 dataframe 的 index 改变为时间序列,但是发现画图坐标轴直接显示为 5 了。。
    https://imgchr.com/i/Atz20e

    感觉这些莫名其妙的问题好打击人
    necomancer
        1
    necomancer  
       Mar 26, 2019
    df.set_index(pd.to_datetime(df[5])).plot()
    或者 df2.index=pd.to_datetime(df[5])
    检查一下 dtype,你需要转换成时间,字符串不行的。
    necomancer
        2
    necomancer  
       Mar 26, 2019   ❤️ 1
    或者 df = df.set_index(pd.to_datetime(df[5]))
    再 df['ema'].plot()
    yellowtail
        3
    yellowtail  
    OP
       Mar 26, 2019
    @necomancer 已解决,谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   933 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 22:40 · PVG 06:40 · LAX 15:40 · JFK 18:40
    ♥ Do have faith in what you're doing.