What is a rolling window in time series analysis?

Updated May 15, 2026

Short answer

A rolling window computes statistics over a fixed-size moving subset of data.

Deep explanation

A rolling window applies a sliding subset over time series data to compute metrics like mean, variance, or sum. This helps smooth noisy data and capture local trends. It is widely used in feature engineering for ML models.

Real-world example

Calculating 7-day moving average of stock prices.

Common mistakes

  • Using future data in rolling calculations.

Follow-up questions

  • What is the difference between rolling and expanding window?
  • Why use rolling features in ML?

More Time Series interview questions

View all →