Project 20: Revenue Rolling Average
Data Analyst
Builds on these lessons
Current Task
Objective
.rolling(window=N) computes a value (like the mean) over a sliding window of N consecutive rows — the basis of moving averages.
Task: compute a 2-period rolling average over a revenue Series and print it.
index.py
import pandas as pd
revenue = pd.Series([100, 150, 130, 170, 200])
rolling_avg = revenue.rolling(window=2).mean()
print(rolling_avg)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview