Skip to content

Tunnest

flowtask.components.tUnnest

tUnnest

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

Bases: tPandas

tUnnest

Overview

    The tUnnest class is a component for splitting a column in a DataFrame into multiple rows, based on a specified
    separator. This component supports options to drop the original column after splitting and to define a new column
    for the split values.

.. table:: Properties
:widths: auto

    +----------------+----------+-----------+---------------------------------------------------------------+
    | Name           | Required | Summary                                                                |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | source_column  |   Yes    | The name of the column to split into multiple rows.                    |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | destination    |   No     | The name of the column to store the split values. Defaults to source.  |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | drop_source    |   No     | Boolean indicating if the original column should be dropped after split.|
    +----------------+----------+-----------+---------------------------------------------------------------+
    | separator      |   No     | The separator used to split the values. Defaults to ", ".              |
    +----------------+----------+-----------+---------------------------------------------------------------+

Returns

    This component returns a DataFrame where the specified `source_column` is split into multiple rows based on the
    `separator`. If `drop_source` is set to True, the original column is removed after the split. Errors related to
    column splitting are logged and raised as exceptions.


Example:

```yaml
tUnnest:
  source_column: warehouse_store_ids
  destination: store_id
  drop_source: true
```