推荐学习书目
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
zcsnbb
V2EX  ›  Python

pandas 里面的 none 怎么向前填充

  •  
  •   zcsnbb · Oct 19, 2018 · 2032 views
    This topic created in 2765 days ago, the information mentioned may be changed or developed.

    使用过这个 df.fillna(method="pad") 但是没有奏效,是因为不是 nan 吗?

    3 replies    2018-10-22 11:34:14 +08:00
    Les1ie
        1
    Les1ie  
       Oct 20, 2018
    df.fillna("something", inplace=True)
    zcsnbb
        2
    zcsnbb  
    OP
       Oct 22, 2018
    @Les1ie 尝试过了 但是失败了
    Les1ie
        3
    Les1ie  
       Oct 22, 2018
    加了 inplace=True 才会替换当前变量,没加的会返回一个新的对象,

    所以你的问题是这个地方不是 NaN 么.., 不过我遇到的空值都是 NaN 呀..
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   896 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:31 · PVG 04:31 · LAX 13:31 · JFK 16:31
    ♥ Do have faith in what you're doing.