Table operations overview

A quick reference for table operations

This page is a quick-reference index of common table operations in Deephaven. Find your task in the table, then follow the link to the operation's reference page for its syntax and examples.

These operations work on static tables and on real-time tables that tick. When the source data changes, their results update with it. A few have restrictions. range_join supports only static tables. Some operations, such as group_by, raise an error on blink tables. Aggregations on blink tables cover every row since the aggregation started, not only the current cycle's rows. See specialized semantics for blink tables.

To learn a group of operations by task, see the how-to guides:

To choose from the aggregation operations, see Aggregations in Deephaven. To learn the concepts behind table operations, such as immutability, formula strings, and the dependency graph, see Understanding the Table API. For formulas in depth, see Formulas.

Quick reference

I want to...Use this
Keep rows matching a conditionwhere("condition")
Keep rows whose key values appear, or don't appear, in another tablewhere_in(filter_table, cols=["Key"]) / where_not_in(filter_table, cols=["Key"])
Get the first or last n rowshead(n) / tail(n)
Add columns (stored in memory)update(["NewColumn = formula"])
Add columns (computed on demand)update_view(["NewColumn = formula"])
Keep or compute specific columns (stored in memory), dropping the restselect(["Column1", "NewColumn = formula"])
Keep or compute specific columns (computed on demand), dropping the restview(["Column1", "NewColumn = formula"])
Remove columnsdrop_columns(["Column1"])
Rename columnsrename_columns(["NewName = OldName"])
Sort by columnsort("Column")
Sort in descending ordersort_descending("Column")
Add columns from a lookup table (at most one match per row, null if no match)natural_join(other, on=["Key"], joins=["AddedColumn"])
Add columns from a table where every row must have exactly one matchexact_join(other, on=["Key"], joins=["AddedColumn"])
Join every matching row, or cross join with no keyjoin(other, on=["Key"])
Match on a timestamp or other ordered key (closest at or before)aj(other, on=["Key", "Timestamp"], joins=["AddedColumn"])
Match on a timestamp or other ordered key (closest at or after)raj(other, on=["Key", "Timestamp"], joins=["AddedColumn"])
Group right-table values that fall in a range (static tables only)range_join(other, on=["Key", "Start <= Timestamp <= End"], aggs=[agg.group(...)])
Apply one aggregation to every non-key column, per groupsum_by(by=["Key"]) (also avg_by, max_by, min_by, and similar dedicated aggregations)
Count the rows in each groupcount_by("Count", by=["Key"])
Apply different aggregations to different columns, per groupagg_by([agg.sum_(...)], by=["Key"])
Collect each group's values into arrays, or expand arrays back into rowsgroup_by(by=["Key"]) / ungroup()
Compute cumulative or rolling valuesupdate_by([updateby.cum_sum(...)], by=["Key"])
Stack tables on top of each othermerge([table1, table2])

Most entries are methods on a table. merge is a function.

The arguments to agg_by come from the agg module, such as agg.sum_ and agg.group. The arguments to update_by come from the updateby module, such as updateby.cum_sum. Import merge and both modules with:

Diving deeper: API references

For complete signatures, type hints, and operation contracts, see the generated API documentation:

Each operation's reference page, such as where or update, also links to its Pydoc.