augment_leads
augment_leads(
data,
date_column,
value_column,
leads=1,
reduce_memory=False,
engine='auto',
)
Adds lead columns to a pandas or polars DataFrame (or grouped DataFrame).
Parameters
data |
DataFrame or GroupBy(pandas or polars) |
Input tabular data to augment. |
required |
date_column |
str |
Name of the date column used to determine ordering prior to shifting. |
required |
value_column |
str or list |
One or more column names whose lead values will be appended. |
required |
leads |
int or tuple or list |
Lead specification. Accepts: - int: single lead value - tuple(start, end): inclusive range of leads - list[int]: explicit list of lead values |
1 |
reduce_memory |
bool |
If True, attempts to reduce memory usage (pandas only). |
False |
engine |
(auto, pandas, polars) |
Execution engine. When βautoβ (default) the backend is inferred from the input data type. |
"auto" |
Returns
|
DataFrame |
DataFrame with lead columns appended. The return type matches the input backend. |