Skip to content
PathTailor
  • Courses
  • Paths
  • Careers
  • Glossary
  • Companies
  • Schools
  • Pricing
FRSign inBuild my path
PathTailor
  • Courses
  • Paths
  • Careers
  • Glossary
  • Companies
  • Schools
  • Pricing
Build my pathSign inLire en français
  1. Home
  2. Glossary
  3. Lag

Lag

A lag creates a column containing the value of the series n periods earlier, with shift(n). It lets a model use the recent past as a feature. A positive lag looks backward; a negative lag would use the future and cause leakage.

Example

df['ventes_j_moins_7'] = df['ventes'].shift(7)

Related concepts

DatetimeIndexResamplingRolling windowsDecompositionAutocorrelationStationarityDifferencingReference forecastTime-based splitForecast metricsExponential smoothingHolt-Winters

The whole glossary

See this concept in action

Want to go further? Take the Time Series and Forecasting course.

Lesson 1 of 5 · 15 min · advanced levelFree access

Work with a Time Series in pandas

In this lesson, you learn to:

  • create and index a time series with a DatetimeIndex
  • change frequency with resample and aggregate correctly
  • compute rolling windows and shifts (rolling, shift, diff)

Read the lessonBuild my path

PathTailor

Your project. Our path.

Courses are being translated into English; those not yet translated open in French. Personalised lessons are produced in the learner's language.

Build my path

Catalogue

  • All courses
  • Paths
  • Careers
  • Glossary

Platform

  • Pricing
  • Blog (French)
  • About

Organisations

  • Companies
  • Schools

Catalogue updated on 12 November 2026 · v1.1 · Legal notice · Terms · Privacy · Cookies ·