SpinTheMic
Pro

Interview practice question

Monthly revenue from a transactions table

Data Analyst · Python and Pandas · Beginner

Using pandas, how would you calculate total revenue per month from a transactions DataFrame?

What a strong answer covers

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

  • Ensure date column is datetime.
  • Create month: dt.to_period("M").
  • groupby month, sum revenue.
  • Or resample("MS") with date index.
  • Filter cancelled rows first.
Practise this topic

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

See all topics