explore_panel_structure

source

explore_panel_structure(
    df,
    *,
    entity=None,
    time=None,
    var=None,
    max_units=200,
    caption='Panel Structure',
    title=None,
    subtitle=None,
)

Summarise the panel’s balance and coverage, with a unit-by-period presence grid.

A general panel-completeness diagnostic. (For treatment structure on a staggered-adoption design, see :func:expdpy.analyze_panel_view.)

Parameters

Name Type Description Default
df pd.DataFrame Panel data frame. required
entity str | None Cross-sectional (unit) identifier. Defaults to the panel entity. None
time str | None Time identifier. Defaults to the panel time. None
var str | None Optional variable: when given, a cell counts as “present” only if var is non-missing there (rather than merely a row existing). None
max_units int | None Cap on the number of units drawn in the presence grid (evenly sampled above it). 200
caption str Great Tables header for the summary. 'Panel Structure'

Returns

Name Type Description
PanelStructureResult df_summary (tidy statistics), df_grid (full presence matrix), gt and the presence-grid fig.

Examples

import expdpy as ex
from expdpy.data import load_kuznets, load_kuznets_data_def

df = ex.set_labels(load_kuznets(), load_kuznets_data_def(), set_panel=True)
res = ex.explore_panel_structure(df)
res.gt
res.fig