import expdpy as ex
from expdpy.data import load_kuznets
df = ex.set_panel(load_kuznets(), entity="country", time="year")
ex.explore_xtsum_table(df, var=["gini_regional", "log_gdp_pc"]).gt
ex.explore_spaghetti_plot(df, var="gini_regional").figset_panel
set_panel(df, *, entity=None, time=None, entity_name=None)Declare the panel’s entity, time (and optional entity_name) columns on df.
The ids are stored under df.attrs["expdpy_panel"] so that subsequent explore_* / analyze_* calls can omit them. Explicit arguments to those functions still take precedence.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| df | pd.DataFrame | The panel data frame (modified in place — its attrs are updated and the same object is returned). |
required |
| entity | str | None | Name of the cross-sectional (unit) identifier column, or None to leave it unset. |
None |
| time | str | None | Name of the time identifier column, or None to leave it unset. |
None |
| entity_name | str | None | Name of a column holding a human-readable label for each unit (e.g. "country" when entity is an ISO code). When declared, figures render units as Name (id). None leaves it unset. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| pandas.DataFrame | The same df, with df.attrs["expdpy_panel"] updated. |
Examples
Declare the panel once, then explore without repeating the ids: