panel_aware_prefix¶
yohou.utils.panel.panel_aware_prefix(col, prefix)
¶
Add a prefix to a column name while preserving the panel group prefix.
For panel data columns (<GROUP>__<SERIES>), the prefix is inserted
after the group separator: <GROUP>__<PREFIX>_<SERIES>.
For global columns, the prefix is prepended: <PREFIX>_<COLUMN>.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
col
|
str
|
Column name to prefix. |
required |
prefix
|
str
|
Prefix string to add (joined with |
required |
Returns¶
| Type | Description |
|---|---|
str
|
Column name with prefix added in the panel-safe position. |
Examples¶
>>> panel_aware_prefix("sales", "boxcox")
'boxcox_sales'
>>> panel_aware_prefix("store_1__sales", "boxcox")
'store_1__boxcox_sales'
See Also¶
panel_aware_rename: General-purpose panel-aware rename utility.