Pandas isnull(): Check Missing Values
The isnull() function in Python is a function within the pandas library used to check for missing values in data. Its specific usage is as follows:
import pandas as pd
# 创建一个包含缺失值的DataFrame
data = {'A': [1, 2, None, 4],
'B': [None, 5, 6, 7]}
df = pd.DataFrame(data)
# 使用isnull()函数检查缺失值
print(df.isnull())
The output is as follows:
A B
0 False True
1 False False
2 True False
3 False False
The isnull() function will return a boolean DataFrame of the same dimensions as the original DataFrame, where True indicates that the corresponding value is missing, and False indicates that it is not missing.