2019-06-18
阅读量:
521
python如何检查缺失值
为了检查Pandas DataFrame中的空值,我们使用isnull()
函数this函数返回布尔值的数据帧,对于NaN值,这些值为True。
代码#:
# importing pandas as pd
import pandas as pd
# importing numpy as np
import numpy as np
# dictionary of lists
dict = {'First Score':[100, 90, np.nan, 95],
'Second Score': [30, 45, 56, np.nan],
'Third Score':[np.nan, 40, 80, 98]}
# creating a dataframe from list
df = pd.DataFrame(dict)
# using isnull() function
df.isnull()
输出:







评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论