Skip to content

Tfilter

flowtask.components.tFilter

tFilter

tFilter(loop=None, job=None, stat=None, **kwargs)

Bases: FlowComponent

tFilter

Overview

    The tFilter class is a component that applies specified filters to a Pandas DataFrame.
    It allows filtering rows based on multiple conditions and expressions, enabling targeted
    data extraction within a task flow.

.. table:: Properties
:widths: auto

    +--------------+----------+-----------+---------------------------------------------------------------+
    | Name         | Required | Summary                                                                   |
    +--------------+----------+-----------+---------------------------------------------------------------+
    | operator     |   Yes    | Logical operator (e.g., `and`, `or`) used to combine filter conditions.   |
    +--------------+----------+-----------+---------------------------------------------------------------+
    | conditions   |   Yes    | List of conditions with columns, values, and expressions for filtering.   |
    |              |          | Format: `{ "column": <col_name>, "value": <val>, "expression": <expr> }`  |
    +--------------+----------+-----------+---------------------------------------------------------------+

Returns

    This component returns a filtered Pandas DataFrame based on the provided conditions.
    The component tracks metrics
    such as the initial and filtered row counts, and optionally limits the returned columns if specified.
    Additional debugging information can be outputted based on configuration.


Example:

```yaml
tFilter:
  operator: '&'
  filter:
  - column: ClientId
    value:
    - 11076
    expression: ==
```