热线电话:13121318867

登录
2019-04-29 阅读量: 515
python如何检测现有/未缺失的值

DataFrame.notna()函数检测数据框中的现有/非缺失值。该函数返回一个布尔对象,其大小与应用它的对象的大小相同,表示每个单独的值是否为na值。所有非缺失值都映射为true,缺失值映射为false。

代码:使用notna()函数查找数据帧中的所有非缺失值。

# importing pandas as pd

import pandas as pd

# Creating the first dataframe

df = pd.DataFrame({"A":[14, 4, 5, 4, 1],

"B":[5, 2, 54, 3, 2],

"C":[20, 20, 7, 3, 8],

"D":[14, 3, 6, 2, 6]})

# Print the dataframe

print(df)

# find non-na values

df.notna()

0.0000
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子