Complete the code to fill missing values forward in the DataFrame column.
df['A'] = df['A'].[1]()
The ffill() method fills missing values by propagating the last valid observation forward.
Complete the code to fill missing values backward in the DataFrame column.
df['B'] = df['B'].[1]()
The bfill() method fills missing values by using the next valid observation backward.
Fix the error in the code to forward fill missing values in the DataFrame.
df.fillna(method=[1], inplace=True)
The correct method name for forward fill in fillna is 'ffill'.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if the length is greater than 3.
{word: [1] for word in words if [2]The dictionary comprehension maps each word to its length using len(word). The condition filters words with length greater than 3 using len(word) > 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their counts only if the count is greater than 0.
{ [1]: [2] for [3], [2] in data.items() if [2] > 0 }The comprehension maps the uppercase key k.upper() to its value v. It iterates over k, v in data.items() and filters values greater than 0.