DataFrame.unpivot
DataFrame unpivot(string[] valueColumns, string[] indexColumns = [],
string variableName = "variable", string valueName = "value")Unpivots the frame long: the valueColumns stack into variableName/valueName pairs (value-column outer, input row inner), the indexColumns repeat per stacked column, and every other column drops - visible in the signature (Polars 2.0 parity; ADR-2026-10-24-20; the full contract lives on ddn.df.reshape.unpivot). Heterogeneous stacks promote only through the numeric lattice and reject otherwise. Eager-only.
Parameters
valueColumns | the columns to stack (in output order) |
indexColumns | the columns to repeat per stacked column |
variableName | the stacked column-name column |
valueName | the stacked values column |
Returns
the unpivoted frame.
Throws
DataFrameException for absent columns or duplicate
output names.