Skip to main content
Version: Python

filter

The filter method creates a new PartitionedTable containing only the rows meeting the filter criteria. This method is analagous to a where applied to a regular table.

danger

Partitioned tables cannot be filtered on the __CONSTITUENT__ column.

Syntax

PartitionedTable.filter(
filters: Union[str, Filter, Sequence[str], Sequence[Filter]]
) -> PartitionedTable

Parameters

ParameterTypeDescription
filtersUnion[str, Filter, Sequence[str], Sequence[Filter]]

The filter conditions or Filter objects to apply.

Returns

A PartitionedTable.

Example

In the following example, partitioned_table is filtered to create a new partitioned table containing only the rows where IntCol is greater than 2.

from deephaven import empty_table

source = empty_table(5).update(["IntCol = i", "StrCol = `value`"])
partitioned_table = source.partition_by(["IntCol"])

result = partitioned_table.table
result_filtered = partitioned_table.filter("IntCol > 2").table