0
0
Data Analysis Pythondata~10 mins

Forward fill and backward fill in Data Analysis Python - Interactive Code Practice

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

Complete the code to fill missing values forward in the DataFrame column.

Data Analysis Python
df['temperature'] = df['temperature'].[1]()
Drag options to blanks, or click blank then click option'
Afillna
Bbfill
Cffill
Ddropna
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bfill' which fills backward instead of forward.
Using 'fillna' without specifying method.
Using 'dropna' which removes missing values instead of filling.
2fill in blank
medium

Complete the code to fill missing values backward in the DataFrame column.

Data Analysis Python
df['humidity'] = df['humidity'].[1]()
Drag options to blanks, or click blank then click option'
Abfill
Bdropna
Cffill
Dfillna
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ffill' which fills forward instead of backward.
Using 'fillna' without specifying method.
Using 'dropna' which removes missing values instead of filling.
3fill in blank
hard

Fix the error in the code to forward fill missing values in the DataFrame.

Data Analysis Python
df['pressure'] = df['pressure'].fillna(method=[1])
Drag options to blanks, or click blank then click option'
A'ffill'
B'forward'
C'backward'
D'bfill'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'forward' which is not a valid method argument.
Using 'backward' which fills backward.
Using 'bfill' which is backward fill.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.

Data Analysis Python
{word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Bword
Clen(word) > 3
Dword > 3
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as value instead of length.
Using the word in condition instead of length check.
Using incorrect comparison operators.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their values only if the value is greater than 0.

Data Analysis Python
{ [1]: [2] for [3], [2] in data.items() if [2] > 0 }
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
Ck
Ditem
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'item' instead of 'k' and 'v' in the loop.
Using the key instead of value in the condition.
Not converting keys to uppercase.