V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
jxylon
V2EX  ›  Python

萌新~~~Dataframe 如何实现将第 n+1 行各列的值减去第 n 行,结果赋于第 n 行

  •  
  •   jxylon · Mar 12, 2018 · 3592 views
    This topic created in 2968 days ago, the information mentioned may be changed or developed.
    Dataframe 如何实现将第 n+1 行各列的值减去第 n 行,结果赋于第 n 行
    3 replies    2018-03-12 18:13:25 +08:00
    kifile
        1
    kifile  
       Mar 12, 2018
    df.iloc[n,:]-=df.iloc[n+1,:]
    kifile
        2
    kifile  
       Mar 12, 2018
    貌似写反了
    df.iloc[n,:]=df.iloc[n+1,:]-df.iloc[n,:]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5636 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 08:24 · PVG 16:24 · LAX 01:24 · JFK 04:24
    ♥ Do have faith in what you're doing.