【发布时间】:2021-07-12 06:03:45
【问题描述】:
empty string like thisisnull() not find empty string
conn = connect(host='localhost',port=3306,user='root',password='root',database='spiderdata',charset='utf8')
df = pd.read_sql('select * from beikedata_community1',con=conn)
df
df.subway.isnull()
**i want to use 'isnull()' find missing value, but it's not support empty string, what can i do? thanks very much!**
【问题讨论】:
-
我想用'isnull()'查找缺失值,但不支持空字符串,我该怎么办?非常感谢
-
df.replace(r'', np.NaN)? Replacing blank values (white space) with NaN in pandas 对你有帮助吗? -
@Ynjxsjmh 哇!惊人的!非常感谢!
-
@Ynjxsjmh 对不起!您的建议帮助我替换空字符串,但我发现我不能使用 missingno 查找缺失值,您对此有什么好的想法吗?
-
对不起,我以前从未使用过该库,也许您可以将
df.replace(r'', np.NaN)中的np.NaN替换为missingno可以找到的一些值。
标签: python-3.x pandas string dataframe dbnull