moderndid.core.panel.is_balanced_panel#
- moderndid.core.panel.is_balanced_panel(data: Any, idname: str, tname: str) bool[source]#
Check whether the panel is balanced.
A balanced panel has exactly one observation for every unit-period combination. This is a quick Boolean check you can run before passing data to an estimator. If the panel is unbalanced, use
make_balanced_panelto drop incomplete units orfill_panel_gapsto insert null rows for the missing pairs.- Parameters:
- Returns:
- bool
Trueif every unit is observed in every period.
See also
make_balanced_panelDrop units not observed in every period.
diagnose_panelFull diagnostic battery including balance checks.
Examples
In [1]: from moderndid import is_balanced_panel, load_favara_imbs ...: ...: df = load_favara_imbs() ...: is_balanced_panel(df, idname="county", tname="year") ...: Out[1]: False