推荐学习书目
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 · 1640 views
    This topic created in 2633 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   ·   2876 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 15:03 · PVG 23:03 · LAX 08:03 · JFK 11:03
    ♥ Do have faith in what you're doing.