0
0
Pandasdata~10 mins

Counting missing values in Pandas - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to count missing values in the 'Age' column of the DataFrame df.

Pandas
missing_count = df['Age'].[1]().sum()
Drag options to blanks, or click blank then click option'
Aisna
Bsum
Ccount
Disnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'count' which counts non-missing values.
Using 'sum' directly without first identifying missing values.
2fill in blank
medium

Complete the code to count the total number of missing values in the entire DataFrame df.

Pandas
total_missing = df.[1]().sum().sum()
Drag options to blanks, or click blank then click option'
Anotnull
Bcount
Cisnull
Ddropna
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'count' which counts non-missing values.
Using 'dropna' which removes missing values instead of counting.
3fill in blank
hard

Fix the error in the code to correctly count missing values in the 'Salary' column.

Pandas
missing_salary = df['Salary'].[1]().sum()
Drag options to blanks, or click blank then click option'
Aisnull
Bnotnull
Ccount
Ddropna
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'count' which counts non-missing values.
Using 'notnull' which returns True for non-missing values.
4fill in blank
hard

Fill both blanks to create a dictionary with words as keys and their lengths as values, but only for words longer than 3 letters.

Pandas
lengths = {word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Bword > 3
Clen(word) > 3
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'word > 3' which compares a string to a number.
Using 'word' as value instead of length.
5fill in blank
hard

Fill all three blanks to create a dictionary with uppercase words as keys and their lengths as values, only for words longer than 4 letters.

Pandas
result = [1]: [2] for w in words if [3]
Drag options to blanks, or click blank then click option'
Aw.upper()
Blen(w)
Clen(w) > 4
Dw.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using w.lower() instead of uppercase for keys.
Filtering with incorrect length condition.