﻿# Reindexing generated series creates a different gap population from original NaNs

A practical investigation of reindexing generated series creates a different gap population from original NaNs, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-synthetic-pandas-reindex-new-gap-original-missing/
Language: en

## The generated-data scenario

A synthetic sensor generator emits a sparse calendar with an explicitly unavailable measurement. An adapter expands the calendar and fills new positions with a default value. The resulting table contains original unavailable observations and adapter-created positions, which can receive different treatment even though both look missing before filling. The acceptance question is whether the dataset retains the origin of each gap instead of interpreting every final zero as an observed measurement.

## The generation mechanism

Pandas reindex aligns the original index to a requested index and can fill newly introduced positions. Its documentation distinguishes index-based propagation from filling NaNs already present in the original values; fillna is the separate operation for existing missing data. These stages can therefore create different populations in the same output. A complete numeric grid does not explain which cells came from the generator and which were introduced by alignment.

## Define the dataset contract

Define separate masks for emitted observation, emitted unavailable value and position introduced by the adapter. State the permitted default or imputation for each category. Do not reconstruct those masks later solely from the final numeric value, because an observed zero and a chosen fill value can coincide. Keep calendar identity stable so a missing time position is not silently removed and the intervals between observations remain interpretable.

## A step-by-step protocol

First create an invented series containing an observed zero, a nonmissing value, an original NaN and a missing index label. Inspect the original masks before expanding the index. Compare reindex with the chosen fill policy against a later fillna transformation, then export and reload through the actual student adapter. The test should distinguish the gap categories even when their final numeric payloads are identical under the selected preprocessing.

## Evidence required for acceptance

Acceptance evidence includes the original index, requested grid, transformation order, category masks and post-reload assertions. A negative fixture should show that deriving observation status from equality to the fill value loses information. Preserve counts by category rather than reporting only a final missing-cell percentage. A useful release identifies which target positions can be scored as observed data and which merely exercise the model’s response to a declared imputation scenario.

## Failure cases and limits

This protocol does not claim that one filling strategy is best for every forecasting task. Synthetic missingness can follow a deliberately chosen process that differs from real sensor failures. It also does not estimate real zero frequency or data availability. The bounded result is an auditable generator-to-grid contract, preserving the distinction between original values and alignment-created positions so the student does not inherit accidental supervision from a convenient table operation.

## Primary references and related reading

Preserve original observation status before index expansion; reindex filling and fillna act on different missingness paths. [Pandas reindex new labels versus original missing observations](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.reindex.html); [Pandas explicit missing-value replacement](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html).

The proposed investigation of pandas reindex new gap original missing is a proposed dataset-contract review; no production dataset was generated or evaluated. Related reading: [Car Parts forecasting: zero filling changes measured intermittency](/journal/fg2-carparts-zero-filled-intermittency-observation-mask/); [JSON Lines for AI data: a record boundary is not a feature schema](/journal/data-guide-jsonlines-explicit-schema/).
