Recall & Review
beginner
What is forward fill in pandas?
Forward fill is a method to fill missing values by copying the last known non-missing value forward until a new non-missing value appears.
Click to reveal answer
beginner
What does backward fill do in pandas?
Backward fill fills missing values by copying the next known non-missing value backward until a previous non-missing value appears.
Click to reveal answer
beginner
How do you apply forward fill on a pandas DataFrame column named 'A'?
Use df['A'].fillna(method='ffill') to fill missing values in column 'A' by forward filling.
Click to reveal answer
beginner
What is the difference between forward fill and backward fill?
Forward fill uses previous values to fill missing data, while backward fill uses future values to fill missing data.
Click to reveal answer
intermediate
Can forward fill and backward fill be used together?
Yes, you can first apply forward fill to fill missing values, then apply backward fill to fill any remaining missing values.
Click to reveal answer
Which pandas method fills missing values by copying the previous non-missing value?
✗ Incorrect
fillna(method='ffill') copies the last known value forward to fill missing data.
What does fillna(method='bfill') do?
✗ Incorrect
fillna(method='bfill') fills missing values by copying the next known value backward.
If a DataFrame has missing values at the start, which fill method will fill them?
✗ Incorrect
Backward fill fills missing values at the start by using the next available value.
Which method can you use to fill missing values first forward then backward?
✗ Incorrect
Applying forward fill first then backward fill fills missing values from both directions.
What happens if you apply forward fill on a column with no previous non-missing values?
✗ Incorrect
Forward fill cannot fill missing values if there is no previous non-missing value, so they stay missing.
Explain how forward fill and backward fill work to handle missing data in pandas.
Think about filling missing spots by looking backward or forward in the data.
You got /4 concepts.
Describe a situation where you would use both forward fill and backward fill together.
Consider missing data at the beginning and middle of a dataset.
You got /4 concepts.