Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a pandas Series with missing values.
Data Analysis Python
import pandas as pd s = pd.Series([1, 2, [1], 4])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number like 0 or 5 instead of a missing value placeholder.
Leaving the blank empty.
✗ Incorrect
Use None to represent missing values in a pandas Series.
2fill in blank
mediumComplete the code to check for missing values in the Series.
Data Analysis Python
missing = s.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
notnull() which returns True for non-missing values.Using
fillna() or dropna() which modify the Series.✗ Incorrect
The isnull() method returns a boolean Series indicating missing values.
3fill in blank
hardFix the error in the code to fill missing values with zero.
Data Analysis Python
s_filled = s.[1](0)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
dropna() which removes missing values instead of filling them.Using
replace() without specifying the missing value.✗ Incorrect
The fillna() method replaces missing values with the specified value.
4fill in blank
hardFill both blanks to create a dictionary of word lengths for words longer than 3 characters.
Data Analysis Python
lengths = {word: [1] for word in words if len(word) [2] 3} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as the value instead of its length.
Using the wrong comparison operator.
✗ Incorrect
Use len(word) to get the length and filter words with length greater than 3 using >.
5fill in blank
hardFill all three blanks to create a dictionary with uppercase keys and values greater than zero.
Data Analysis Python
result = [1]: [2] for k, v in data.items() if v [3] 0
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using original keys instead of uppercase keys.
Using wrong comparison operator or filtering condition.
✗ Incorrect
Use k.upper() for uppercase keys, v for values, and filter values greater than zero with >.