Complete the code to calculate the rolling mean of the 'sales' column with a window size of 3.
df['rolling_mean'] = df['sales'].[1](3).mean()
The rolling function creates a rolling window to calculate statistics like mean.
Complete the code to calculate the rolling sum of the 'temperature' column with a window size of 5.
df['rolling_sum'] = df['temperature'].[1](5).sum()
The rolling function is used to create a moving window, then sum() calculates the sum within each window.
Fix the error in the code to correctly calculate the rolling mean with a window size of 4.
rolling_avg = df['value'].rolling([1]).mean()
The rolling function expects an integer for the window size, not a string or keyword argument.
Fill both blanks to create a rolling sum with window size 3 and minimum periods 2.
rolling_sum = df['data'].[1](3, [2]=2).sum()
rolling creates the rolling window. min_periods sets the minimum number of observations required to have a value.
Fill all three blanks to create a dictionary comprehension that maps each word to its rolling mean length if length is greater than 3.
result = {word: df['lengths'].rolling([1]).mean().iloc[i] for i, word in enumerate(words) if [2](word) [3] 3}The window size is 3, len gets the word length, and > checks if length is greater than 3.