moderndid.core.panel.has_gaps#

moderndid.core.panel.has_gaps(data: Any, idname: str, tname: str) bool[source]#

Check whether the panel has any implicit missing unit-time pairs.

A lightweight Boolean check that compares the number of observed unit-period pairs against the full cross-product. If this returns True, call scan_gaps to see which specific pairs are missing, then decide whether to fill them with fill_panel_gaps or drop incomplete units with make_balanced_panel.

Parameters:
dataDataFrame

Panel data. Accepts any object implementing the Arrow PyCapsule Interface (__arrow_c_stream__), including polars, pandas, pyarrow Table, and cudf DataFrames.

idnamestr

Unit identifier column.

tnamestr

Time period column.

Returns:
bool

True if there are missing unit-time combinations.

See also

scan_gaps

Materialise the missing unit-time pairs.

fill_panel_gaps

Insert null rows for the missing pairs.