Challenge - 5 Problems
Missing Values Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of isnull() on a DataFrame
What is the output of the following code snippet?
Data Analysis Python
import pandas as pd import numpy as np df = pd.DataFrame({ 'A': [1, np.nan, 3], 'B': [np.nan, 2, 3] }) result = df.isnull() print(result)
Attempts:
2 left
💡 Hint
Remember that isnull() returns True where values are missing (NaN).
✗ Incorrect
The DataFrame has NaN at positions (0, B) and (1, A). isnull() marks these as True, others as False.
❓ data_output
intermediate2:00remaining
Counting missing values with isna()
What is the output of this code that counts missing values per column?
Data Analysis Python
import pandas as pd import numpy as np df = pd.DataFrame({ 'X': [np.nan, 1, 2, np.nan], 'Y': [3, 4, np.nan, 6] }) missing_counts = df.isna().sum() print(missing_counts)
Attempts:
2 left
💡 Hint
Count how many NaN values appear in each column.
✗ Incorrect
Column X has NaN at positions 0 and 3 (2 total). Column Y has NaN at position 2 (1 total).
🔧 Debug
advanced2:00remaining
Identify the error in using isnull() on a list
What error will this code raise?
Data Analysis Python
import pandas as pd values = [1, None, 3] result = values.isnull() print(result)
Attempts:
2 left
💡 Hint
Check if the list type supports isnull() method.
✗ Incorrect
The isnull() method is a pandas DataFrame or Series method, not available on Python lists.
🚀 Application
advanced2:00remaining
Filter rows with missing values using isna()
Which code snippet correctly filters rows with any missing values in DataFrame df?
Data Analysis Python
import pandas as pd import numpy as np df = pd.DataFrame({ 'A': [1, np.nan, 3], 'B': [4, 5, np.nan] })
Attempts:
2 left
💡 Hint
Use isna() with any() along rows to find rows with missing values.
✗ Incorrect
any(axis=1) checks if any column in a row is missing, filtering those rows.
🧠 Conceptual
expert2:00remaining
Difference between isnull() and isna() in pandas
Which statement best describes the difference between pandas isnull() and isna() methods?
Attempts:
2 left
💡 Hint
Check pandas documentation for isnull() and isna() methods.
✗ Incorrect
In pandas, isnull() and isna() are aliases and behave identically to detect missing values.