gpt4 book ai didi

python - 如何用 0 替换 NULL

转载 作者:行者123 更新时间:2023-12-02 00:06:35 25 4
gpt4 key购买 nike

我试图将 NULL 值替换为零。

使用 rf['Pt 1']=rf['Pt 1'].fillna(0,inplace=True) 仅有助于将空白替换为 0。

但我仍然没有设法用零替换 NULL(即字符串 "Null",而不是 None 值)。

有人知道如何用 0 替换 NULL 吗?

rf['Pt 1']=rf['Pt 1'].fillna(0,inplace=True)

我的输出结果:

    Pt 1
0
NULL
990
991
996
995
992
992
992
993
993
993
991
991
989
NULL
NULL
NULL
995
993

最佳答案

使用 Pandas

我希望 DataFrame.fillna() 能正常工作。 Refer Documentation for more insight

关于python - 如何用 0 替换 NULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60426934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com