SpinTheMic
Pro

Interview practice question

Customers who purchased in the last 30 days

Data Analyst · Python and Pandas · Beginner

How do you find customers who made a purchase in the last 30 days using pandas?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Ensure datetime dtype.
  • cutoff = reference date − pd.Timedelta(days=30).
  • Filter df[df.date >= cutoff].
  • unique customer IDs.
  • Use fixed reference date for reproducibility.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics