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
youthfire
V2EX  ›  Python

Count SQLite 中某个 Column 时遇到的问题

  •  
  •   youthfire · Mar 7, 2019 · 1586 views
    This topic created in 2609 days ago, the information mentioned may be changed or developed.

    想要统计某个 Column 存在数值的单元格总数时发生错误。

    通过排查发现,默认情况下,单元格都是 Null,用 DB Browser 点击具体单元格,显示 Type of data currently in cell:Null. 但存在一些单元格是空的,点击显示 Type of data currently in cell:Text/Numeric (怀疑是用 Pandas 写入时造成的),但这些又不是空格。统计时,总是把这些单元格也统计为有具体数值的,导致错误。

    求教怎么让这些空的(又不是空格)的单元格变成 Null?

    1 replies    2019-03-07 12:24:11 +08:00
    xpresslink
        1
    xpresslink  
       Mar 7, 2019   ❤️ 1
    建议楼主先把概念整明白了, 再弄。
    空字符串"",空格" ", 空值 NULL 是三个完全不同的东东。

    update tablename
    set columnname = NULL
    where columname ="" or columname =" ";
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1405 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:03 · PVG 01:03 · LAX 10:03 · JFK 13:03
    ♥ Do have faith in what you're doing.