美文网首页
python筛选数据框某列非空的行

python筛选数据框某列非空的行

作者: 丙吉 | 来源:发表于2020-04-13 16:46 被阅读0次

筛选某个变量的空值:

data[np.isnan(data['userId']) == False]

df = df[(df[col].notnull) & (df[col] != "")]

isnan 判断是不是Nan,Nan的意思是not a number,一般是数值字段的null,

isnull () 主要判断字符型是不是有值,严格来说 isnull () 可以判断所有的空值,但是python的数值字段比如int float 为空的时候默认是Nan

相关文章

网友评论

      本文标题:python筛选数据框某列非空的行

      本文链接:https://www.haomeiwen.com/subject/uiknmhtx.html