Missing Values
NaN marks missing values. isna finds them, dropna removes and fillna fills them.
Example
df = pd.DataFrame({"a": [1, None, 3], "b": ["x", "y", None]})
print(df.isna().sum().tolist())
print(df.dropna().shape)
print(df.fillna({"a": 0, "b": "?"}))Result
[1, 1]
(1, 2)
a b
0 1.0 x
1 0.0 y
2 3.0 ?Exercise
Find missing.
df.()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.