Skip to content
ML Academy

Time series and forecasting · insight-0253

Build an explicit time grid so missing periods are not mistaken for zeros or skipped

Evidence type
practitioner heuristic
Difficulty
easy
Roles
Data analyst, Data scientist
Industries
aviation, manufacturing, energy

Summary: situation, action, reason, boundary

  1. Situation

    A route's daily table has a nine-day gap where no rows exist, and the lag-7 feature is computed with row offsets.

  2. Action

    Reindex every series to a complete calendar at its frequency, mark missing periods explicitly, decide per cause whether they are true zeros, unknown values to impute, or periods to exclude, and compute lags by date.

  3. Reason

    Missing timestamps and true zeros mean different things, and most lag, seasonal and metric computations assume a regular grid.

  4. Boundary

    Operational logs, sensor feeds, raw transaction extracts, panels with store closures.

Symptom or risk

Row-based lags silently point to the wrong dates across the gap, and filling the gap with zeros invents a demand collapse.

Exceptions

Event-based models designed for irregular timestamps can work without a grid, but still need the gap explained.

Trade-offs

Imputing gaps keeps series continuous but can create false certainty; flag imputed points in features.

Pitfalls

Counting imputed values as actuals when computing accuracy.

Example

The synthetic flight_day_raw table has a nine-day IST-TZX gap from 2023-03-04 to 2023-03-12.

Lessons and concepts