inspect_panel¶
yohou.utils.inspect_panel(df)
¶
Inspect DataFrame columns to distinguish global and local (panel) data.
Global columns apply to all time series (e.g., single univariate series or
features common across all panels). Local columns use the __ separator to
indicate panel data groups following the pattern
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame with potential mix of global and group columns. The "time" column, if present, is excluded from the output. |
required |
Returns ¶
| Name | Type | Description |
|---|---|---|
global_names |
list of str
|
Names of columns without __ separator (excluding "time"). |
panel_groups |
dict of str to list of str
|
Mapping from group prefixes to their full column names. Example: {"store_1": ["store_1__sales", "store_1__returns"]} |
Examples ¶
>>> import polars as pl
>>> # Global time series (single series)
>>> df_global = pl.DataFrame({"time": [1, 2, 3], "value": [10, 20, 30]})
>>> global_names, panel_groups = inspect_panel(df_global)
>>> global_names
['value']
>>> panel_groups
{}
>>> # Panel data with __ separator (<entity>__<variable>)
>>> df_panel = pl.DataFrame({
... "time": [1, 2, 3],
... "store_1__sales": [100, 110, 120],
... "store_2__sales": [150, 160, 170],
... })
>>> global_names, panel_groups = inspect_panel(df_panel)
>>> global_names
[]
>>> panel_groups
{'store_1': ['store_1__sales'], 'store_2': ['store_2__sales']}
See Also ¶
select_panel_columns : Filter DataFrame to panel group columns and global columns
Source Code ¶
Source code in src/yohou/utils/panel.py
Tutorials¶
The following example notebooks use this component:
-
How to Aggregate Scorer Results
Demonstrate all scorer aggregation strategies (stepwise, vintagewise, componentwise, groupwise, coveragewise, all) on panel data with weighted group aggregation.
-
How to Apply Stationarity to Panel Data
Apply per-group stationarity transforms on panel data with SeasonalDifferencing, DecompositionPipeline (polynomial trend + pattern seasonality), and residuals.
-
How to Configure LocalPanelForecaster
Wrap any forecaster with LocalPanelForecaster for fully independent per-group clones, parallel fitting via n_jobs, and selective group operations.
-
How to Forecast Panel Data with ColumnForecaster
Apply a shared forecasting model across multiple series in a panel dataset using ColumnForecaster with the __ column separator convention.
-
How to Forecast Panel Prediction Intervals
Combine conformal and quantile regression intervals on panel data with per-group coverage analysis, calibration plots, and groupwise interval scoring.
-
How to Preprocess Panel Data
Automatic panel-aware transformation (StandardScaler, rolling stats, imputation) plus manual per-group workflows with get_group_df and dict_to_panel.