API index
Use this page to find an operation by task. Detailed signatures, parameter defaults, return types, and exceptions are rendered on the linked class pages. The final table lists aliases alongside their canonical names.
Construct a pipeline
| Task | Entry point | Notes |
|---|---|---|
| Synchronous values or records | flow(source) |
Primary synchronous constructor; routes supported tabular inputs |
| Fresh source per execution | flow.defer(factory) |
Use for reopenable files, queries, or iterator factories |
| Positional values | flow.of(*items) |
Reusable tuple-backed source |
| Optional single value | flow.of_nullable(value) |
Empty for None, otherwise one item |
| Repeated state transition | flow.iterate(seed, function) |
Infinite until bounded downstream |
| State-driven generation, 2.4.0 | flow.unfold(seed, function) / aflow.unfold(...) |
Emit (value, next_state) transitions until the callback returns None |
| Repeated supplier | flow.generate(supplier) |
Infinite until bounded downstream |
| Async values | aflow(source) |
Accepts async or supported synchronous sources |
| Key/value values | pairs(source) |
Explicit pair pipeline |
| Explicit record view | rows(source) |
Relational and record-I/O namespace |
| Explicit named columns | flow.from_columns / rows.from_columns |
Equal-length columns retained through Arrow |
| Explicit NumPy values | flow.from_numpy |
One-dimensional scalars or two-dimensional named records |
| Explicit NumPy records | rows.from_numpy |
Two-dimensional array retained as named, replayable records |
Tabular constructors are listed in data input and output.
Transform and filter Flow values
| Category | Canonical methods |
|---|---|
| One-to-one transform | map, map_first, map_last, pair_map, tap |
| Zero-or-one transform | filter, reject, filter_map, filter_none, compact |
| One-to-many transform | flat_map |
| Adjacent-run reduction | collapse(predicate, merger); the 2.4.0 overload also accepts a Collector |
| Prefix/suffix bounds | take, drop, take_while, take_while_inclusive, drop_while |
| Stateful transform | fold, scan, scan_right, fold_by, reduce_by, gather |
| Stateful mapping, 2.4.0 | map_accum(initial, function) emits outputs from (next_state, output) transitions |
| De-duplication | unique, unique_by, distinct, distinct_by |
| Error/value partitioning | attempt, partition_results |
| Engine/concurrency view | with_engine, parallel, sequential, map_parallel |
See Flow for complete signatures.
In Flow and AsyncFlow, fold(initializer, function) lazily emits one accumulated
value. The initializer is a factory; consume the returned flow to run it.
reduce and fold_right (an alias of reduce_right) are terminals.
The 2.5.0 AsyncFlow.fold_async
adds explicitly awaitable hooks and a declared resolved accumulator type.
filter_none() drops only None in both Flow and AsyncFlow. In v2,
compact() drops only None in Flow but all falsey values in AsyncFlow;
the same distinction applies to a supplied selector. See
moving between execution domains
before porting a pipeline.
Batch, window, and order
| Category | Canonical methods |
|---|---|
| Fixed grouping | chunk, window, pairwise, batch |
| Window aggregation (2.4.0) | window_reduce(size, combine, step=1) |
| Rolling statistics (2.5.0) | rolling_statistics(size, selector=..., ddof=0); recipe |
| One callback per batch | map_batches |
| Conditional grouping | chunk_by, batch_by_size, constrained_batches, group_runs, collapse |
| Stable order | sort_by, sorted, external_sort_by, top, bottom |
| Position | enumerate, zip_with_index, map_first, map_last |
| Separation | intersperse |
Combine pipelines
| Shape | Methods |
|---|---|
| Sequential | append, prepend, concat |
| Position-wise | zip, zip_longest |
| Cartesian | cross, cartesian |
| String terminal | join(separator) |
AsyncFlow adds merge, combine_latest, flat_map_merge, merge_map, and
switch_map for concurrent sources.
Scalar and collection terminals
| Category | Terminals |
|---|---|
| Cardinality/truth | count, count_by, any, all, none |
| Element lookup | first, last, nth, find, find_index, index_of |
| Numeric | sum, min, max, minmax, mean, average, variance, std |
| General reduction | fold_right, reduce, reduce_right, aggregate, summarize, collect |
| Distribution | frequencies, partition, describe |
| Containers | to_list, to_tuple, to_set |
| Data systems | to_numpy, to_pandas, to_csv |
| File/effect output | to_json, for_each, iteration |
| Planning and observation | explain, run_with_report |
Terminals that require an element document their empty-input policy. Statistical
terminals return None where the statistic is undefined.
The source version can also include static field inputs with
query.explain().to_dict(include_field_dependencies=True) on Flow and Rows.
See the plan dictionary reference.
Work with records
| Task | Rows methods |
|---|---|
| Choose or derive columns | select, with_columns, rename, drop, cast, parse |
| Filter | filter, where |
| Null handling | fill_nulls, drop_nulls |
| Group | group_by(...).aggregate(...), aggregate |
| Join | join |
| Concatenate sources | concat |
| Ordering/deduplication | sort_by, external_sort_by, unique_by, distinct_by |
| Reshape | explode, unnest, unpivot, pivot |
| Row materialization | to_list, to_columns, first, last, count |
| Flow view and observation | to_flow, explain, run_with_report |
| NumPy/Arrow/dataframes | from_columns, from_numpy, to_numpy, arrow_batches, polars_batches, to_arrow, to_pandas, to_polars |
See Rows, expressions, and I/O.
Aggregate once
agg creates aggregators for Rows.aggregate, GroupedRows.aggregate, and
multi-reduction programs.
| Result | Factories |
|---|---|
| Counts | agg.count, agg.count_where, agg.count_distinct |
| Numeric | agg.sum, agg.mean, agg.variance, agg.std, agg.min, agg.max |
| Item by key | agg.min_by, agg.max_by (2.4.0) |
| Ranked items | agg.top, agg.bottom (2.4.0) |
| Encounter order | agg.first, agg.last |
| Truth | agg.any, agg.all |
| Collection | agg.collect |
Collector factories in Collectors cover general iterable reduction, mapping,
filtering, partitioning, grouping, joining, and downstream composition. Reducer
objects describe associative laws when parallel or tree reduction needs explicit
proof.
The source version also provides Collectors.statistics for shared exact
statistics and optional Collectors.approx_quantiles and
Collectors.approx_count_distinct sketches. These factories are 2.5.0;
see shared and approximate statistics
for input policies, installation, and error bounds.
The exact percentile recipe uses collector composition for grouped p50 and p90 values, with explicit missing-value and small-group policies.
Transform pairs
| Task | Pairs methods |
|---|---|
| Transform | map_keys, map_values, map_pairs, flat_map_pairs, tap |
| Filter | filter_keys, filter_values, filter_pairs |
| De-duplicate/order | unique_keys, sort_by_key, sort_by_value |
| Per-key values | group_values, collect_values, aggregate_values |
| Views and execution policy | keys, values, items, invert, to_flow, with_engine |
| Terminal | to_dict |
| Execution report | run_with_report |
See Pairs.
Async operations
AsyncFlow shares most synchronous transformations and the count, truth,
lookup, reduction, frequency, sum, extreme-value, mean, variance, and
standard-deviation terminals. It does not currently expose describe. Its
async-only groups are:
| Task | Methods |
|---|---|
| Explicit async state (2.5.0) | fold_async(initializer, function) |
| Concurrent callbacks | map_async, flat_map_merge, merge_map, switch_map |
| Multiple async sources | merge, combine_latest |
| Rate and time | delay, interval, spaceout, throttle, debounce, timeout |
| Time and session buffers | batch_timeout, buffer_timeout, session_window |
| Pull-ahead buffering | prefetch |
| External sources | from_queue, from_file, paginate |
Concurrency, ordering, cancellation, and buffer bounds are documented with each method on AsyncFlow.
The 2.5.0 Collectors.averaging_with
keeps accumulator and result types explicit. For record filtering,
Rows.drop_nulls(missing="raise")
propagates selected lookup failures; its compatibility default remains "legacy".
Expressions
| Namespace | Purpose |
|---|---|
item |
Integer/scalar expression with Python integer semantics |
fitem |
Floating expression and native floating kernels |
col(name) |
Read a record column or path |
lit(value) |
Embed a literal in a row expression |
when(condition, then, otherwise=None) |
Choose a value; the false branch defaults to None |
coalesce(*values) |
First non-None row expression |
See the full operator and precedence notes under expressions.
Values, errors, and runtime controls
| Area | Public names |
|---|---|
| Optional/result values | Option, Result, Ok, Err |
| Statistics | SummaryStatistics |
| Execution reports | ExecutionResult, ExecutionReport; ExecutionEvent and versioned report/event to_dict() export added in 2.4.0 (guide) |
| Spill budgets | SpillLimits |
| Shared executor budget, 2.4.0 | BoundedExecutor |
| File partition recovery, 2.4.0 | FileCheckpoint |
| Collection laws | Reducer, ReducerAggregator, ReducerLaws, ReducerLawError, LawProvenance, ReductionExplanation |
| Error base | FlowError |
| User-facing errors | FlowConsumedError, EmptyFlowError, SelectionError, DuplicateKeyError, NativeUnsupportedError, BufferLimitError |
See Option and Result and errors and runtime values.
Canonical names and aliases
Aliases exist for migration or familiarity. New documentation uses the canonical name in the left column.
| Canonical | Aliases |
|---|---|
take |
Flow: limit; Rows: limit, head |
Flow.drop / Rows.skip |
Flow: skip; Rows: offset |
filter |
Flow: where; Rows: where also accepts field equalities |
unique / unique_by |
distinct / distinct_by |
mean |
average |
map_parallel |
parallel_map |
to_numpy |
to_np |
to_pandas |
to_df |
fill_nulls |
fillna (Rows) |
drop_nulls |
dropna (Rows) |
from_dataframe |
from_pandas |
Flow |
Stream; ParallelStream is a compatibility alias |
AsyncFlow |
AsyncStream |
Rows.drop(*columns) removes fields; use Rows.skip(count) to skip records.
reject negates a predicate and is listed with filtering operations above.