Filter by expression: filterExpression
Keep rows where a boolean expression evaluates to true. Unlike
Filter rows (one column, one operator), this handles several
conditions combined with and / or in a single expression.
Use cases
- Multi-column filters:
amount > 100 and status == 'paid'. - Ranges and combinations:
score >= 0.8 or manual_review == True. - Arithmetic conditions:
revenue - cost > 0.
What it does
The expression is evaluated per row with pandas eval semantics, and only rows
where it is true are kept. The polars engine converts the frame to pandas to
evaluate the mask, so both engines give the same result (and the Polars export
needs pandas and PyArrow). Calculated column uses
different syntax on Polars. Column count is unchanged; the row index is reset.
Flow assistant
The flow assistant can add this node. It accepts only
column references, numbers, single-quoted text, arithmetic and comparison
operators, and/or/not, and a few math functions, and it highlights the
expression for your review before you save.
Configuration
| Config key | Type | Required | Description |
|---|---|---|---|
expression | string | Yes | A boolean expression over the columns |
Reference columns by name; use and / or / not, comparisons (==, !=,
>, >=, <, <=), and arithmetic (+ - * /).
Build condition helper
Above the expression textarea, the config panel also has an optional
Build condition mini-form: pick a column, an operator, and a value, then
click AND or OR to append the resulting condition onto whatever is
already in the expression. It's purely a convenience for constructing the
expression string one piece at a time; it doesn't add any config of its own,
and you can ignore it and type the expression by hand instead.
Generated Python code
These exports keep only rows with amount > 100 and status == "paid". The Polars export uses eager frames and evaluates the mask through pandas, so it also requires pandas and PyArrow.
pandas
df_2 = df_1[df_1.eval("amount > 100 and status == 'paid'").fillna(False)].reset_index(drop=True)Polars
# the filter expression uses pandas eval semantics (needs pandas + pyarrow installed)
df_2 = df_1.filter(pl.Series(df_1.to_pandas().eval("amount > 100 and status == 'paid'")).cast(pl.Boolean))Tips & common mistakes
- Use
==for equality (not=), and quote text values:status == 'paid'. - Rows with a missing value drop out. When a comparison is null, for example
age >= 0on a row with no age, the row is not kept, on both engines. - For a single simple condition, Filter rows is quicker.
- To produce a label from conditions instead of filtering, use Conditional column.