SpinTheMic
Pro

Explain it in 60 seconds

Rolling windows, expanding windows and shift

Data Analyst · Python and Pandas · Intermediate

How do you calculate moving averages, cumulative values and period-over-period changes in pandas?

What a strong answer covers

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

  • rolling(window).mean() for moving averages.
  • expanding().sum() / cumsum for cumulative.
  • shift(n) for previous values.
  • pct_change for growth.
  • groupby + transform for per-group.
Practise this topic

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

See all topics