DSM

Interview Prep

Real Interview Questions

SQL, Python, Pandas, ML, and Statistics questions from top tech companies. Solve them directly in the browser.

Company
Topic
Difficulty
GooglePandasMedium

Compute rolling 7-day average

Given a DataFrame with columns 'date' (datetime) and 'revenue' (float), write a query that adds a column 'revenue_7d_avg' containing the 7-day rolling average of revenue, sorted by date.

PYTHON
rolling(7):Window size must be 7 days
First 6 rows NaN:Rolling window starts returning values only after 7 data points