base.pivot

Reshape a table between long and wide form. In "wider" mode the distinct values of names_from become new columns, filled from values_from (one value per id/name cell). In "longer" mode the values_from columns are gathered into a variable/value pair keyed by id_columns. Accepts CSV or Parquet input and emits Parquet output.

  • Kind: standard
  • Network: no

Inputs🔗

NameTypeDescription
tablefile (Parquet, CSV accepted)Source table.
directionstring"wider" (default) or "longer".
id_columnsstringComma-separated columns that identify a row and are preserved on both sides of the reshape.
names_fromstringwider: the column whose distinct values become new column names. longer: unused.
values_fromstringwider: the column whose values fill the new columns. longer: comma-separated columns to gather (empty = all non-id columns).
fillstringwider only: numeric value to substitute for empty cells (e.g. "0" to match the reference workflow's NA-to-zero on height bins). Empty (default) leaves them null.

Outputs🔗

NameTypeDescription
resultfile (Parquet)The reshaped table.

Example🔗

- id: 01890000-0000-0000-0000-00000000000e
  name: base.pivot
  inputs:
    - 01890000-0000-0000-0000-000000000000
  args:
    direction: "wider"
    id_columns: "plot_id"
    names_from: "height_bin"
    values_from: "count"
    fill: "0"