Filter Rows

Shipping
df_filter

Keep rows where a column matches a condition (=, ≠, <, >, contains, is null…)

Signature

Inputs

  • dfDataFramerequiredThe frame whose rows are tested against a single-column predicate.

Outputs

  • dfDataFrameThe subset of rows that satisfy the condition, in original order; all columns reindexed together.

Parameters

KeyTypeDefaultNotes
columnstringColumn to test (name or 0-based index). An unknown column is an error.
openumgtone of: eq, ne, lt, le, gt, ge, contains, is_null, not_null
valuestringRight-hand operand: a number for numeric comparisons, otherwise text. Ignored for is_null / not_null.

Description

Filter Rows (df_filter) keeps the DataFrame rows for which one column satisfies a comparison. You pick the column (name or index), a comparison op, and a right-hand value; the node computes the surviving row indices and reindexes every column by that same list, so all columns stay aligned and in their original row order.

The comparison is type-aware. When the target column is numeric-ish (anything but free text) and the operand parses as a number, df_filter takes a numeric fast path — the common scientific case like temp > 25. Otherwise it compares the cell's display text: eq/ne by exact string, contains by substring, and the ordering ops (lt/le/gt/ge) lexicographically. NULL cells never satisfy a comparison. The two null tests, is_null and not_null, are dtype-agnostic and ignore the operand entirely.

Since filtering only reindexes existing cells, types, units and null masks are preserved. The node is stateless; an unknown column is a hard error.

Mathematics

Examples

Numeric greater-than

On a column t = [1, 5, 9] with op = gt, value = 4, the surviving rows are those with , i.e. 5 and 9 — 2 rows. The numeric path is taken because 4 parses as a number.

String equality and contains

On a text column name = ["alpha", "beta", "gamma"]: op = eq, value = "beta" keeps row 1; op = contains, value = "mm" keeps only "gamma". Non-numeric operands force the text path.

Applications

  • Gating an imported dataset to a region of interest (e.g. keep rows where pressure ≥ threshold).
  • Dropping invalid or missing rows with not_null before statistics or export.
  • Text filtering categorical columns with contains / eq (e.g. keep only rows tagged "passed").
  • Windowing a table to a time range by chaining two df_filter nodes (t ≥ t0 then t ≤ t1).

Neat

The predicate auto-switches between a numeric and a text path per operand: `> 25` compares as f64, `contains "err"` compares as text — no separate node needed.

NULLs are treated as never-satisfying for every comparison, so filters can't accidentally admit missing data; is_null / not_null are the only way to select on nullness.

Surviving indices are produced in ascending order, so a filter never reshuffles rows — the output is a strict subsequence of the input.

Known issues

Lexicographic ordering on text means numeric strings sort by characters, not value ("10" < "9"); store numbers as a numeric column for value comparisons.

The value operand for is_null / not_null is ignored — supplying one has no effect.

See also

dataframefilterrowspredicatenull-awarestateless