Calculated column: calculatedColumn
Add a column computed from an expression over existing columns.
Use cases
- Derive
total = price * quantityormargin = revenue - cost. - Build a ratio or percentage from two columns.
What it does
Evaluates a column-based arithmetic expression and appends the result as a new column. All original columns are preserved unchanged.
| product | price | quantity |
|---|---|---|
| Widget | 9.99 | 10 |
| Gadget | 24.99 | 3 |
| Doohickey | 4.99 | 25 |
| product | price | quantity | totalnew |
|---|---|---|---|
| Widget | 9.99 | 10 | 99.9 |
| Gadget | 24.99 | 3 | 74.97 |
| Doohickey | 4.99 | 25 | 124.75 |
Configuration
| Config key | Type | Required | Description |
|---|---|---|---|
column_name | string | Yes | New column name |
expression | string | Yes | Arithmetic expression, e.g. price * quantity |
The editor offers formula templates that fill the expression from your upstream column names.
The pandas engine evaluates the expression with DataFrame.eval; the Polars
engine parses it as a SQL expression (pl.sql_expr). Column names, numbers,
+ - * / and parentheses behave the same on both.
Flow assistant
The flow assistant can add this node. It accepts only
column references, numbers, arithmetic and a few math functions (abs, sqrt,
exp, log10, log1p, sin, cos, floor, ceil), and it highlights the
expression for your review before you save.
Generated Python code
These exports add total = price * quantity, preserving the input columns and row order. A missing price produces a missing total.
pandas
df_2 = df_1.eval('total = price * quantity')Polars
df_2 = df_1.with_columns(pl.sql_expr('price * quantity').alias('total'))Tips & common mistakes
- Arithmetic expressions only (column names, numbers,
+ - * /, parentheses). For if/else logic use Conditional column; for ranks/running totals use Window function. - Reference columns by their exact name. Quoting for names with spaces differs
between pandas
eval(backticks) and Polars SQL (double quotes), so rename such columns with Rename columns first.