Lagged Correlation Between Notification Sends and App Opens in Pandas

Last updated: November 29, 2026

Quick Overview

Given daily counts of push notifications sent and app opens for Facebook, compute the correlation between day-over-day changes in sends and changes in opens at lags of zero to seven days, so you can see how long the effect of notifications takes to show up.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Take-home Project
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given daily counts of push notifications sent and app opens for Facebook, compute the correlation between day-over-day changes in sends and changes in opens at lags of zero to seven days, so you can see how long the effect of notifications takes to show up.

A pandas take-home style question for Meta notifications data scientists, who need to reason about delayed effects in time series. The interviewer checks that you difference both series to remove the shared trend, align lags in the right direction, and treat gaps explicitly.

What the Interviewer Expects
  • Reindex to a complete daily frequency so shifts mean days
  • Difference both series to remove trend
  • Shift opens backward by the lag to pair sends at t with opens at t plus lag
  • Report the number of pairs at each lag
  • Avoid causal claims from correlation
Key Topics to Cover
pandas shift
cross-correlation
differencing
asfreq
time series
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • Why does correlating raw levels mislead here?
  • How would you test whether the lag-2 correlation is significant?
  • What design would actually measure the causal effect of notifications?
  • How would weekly seasonality affect the result?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

daily has columns ds, sends, opens. Some days may be missing from the export. I want corr(change in sends at t, change in opens at t + lag) for lag 0 to 7. A positive lag means opens respond a...

Approach

Set a DatetimeIndex and call asfreq('D'), so missing days become NaN rows and shift(k) means k days rather than k rows. Difference both series: both grow with the user base, and raw levels would c...


Submit Your Answer
Markdown supported