All docs
Table·
method
Table.with_column
adds or replaces a column from a column expression or array
Python
with_column(name: str, value: Any) -> Table
Returns Table — a new Table with the column added or replaced
Parameters#
| name | type | default | description |
|---|---|---|---|
name |
str |
— | the column to add or overwrite |
value |
Column | pa.Array |
— | a Column expression or a pyarrow array to store under name |
Example#
Python
t.with_column("bonus", t["score"] * 2) # add a computed column
Reusing the name replaces the existing column:
Python
t.with_column("score", t["score"] + 1) # overwrite in place (new Table)
Notes#
If name already exists it is replaced; otherwise it is appended as a new last column.
Every call returns a new Table — the original is untouched.
See also#
Guides: Tables & data flow
By LSD Team · Last updated Jul 17, 2026
Ask on Discord
View as Markdown