Skip to content

Tmerge

flowtask.components.tMerge

tMerge

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

Bases: FlowComponent

tMerge

Overview

    The tMerge class is a component for merging two DataFrames (or named Series objects) using a database-style join.
    It supports different join types such as 'inner', 'outer', 'left', 'right', and 'cross', allowing flexible merging
    configurations for complex data workflows.

.. table:: Properties
:widths: auto

    +------------------+----------+-----------+---------------------------------------------------------------+
    | Name             | Required | Summary                                                                   |
    +------------------+----------+-----------+---------------------------------------------------------------+
    | df1              |   Yes    | The left DataFrame to join.                                               |
    +------------------+----------+-----------+---------------------------------------------------------------+
    | df2              |   Yes    | The right DataFrame to join.                                              |
    +------------------+----------+-----------+---------------------------------------------------------------+
    | type             |   No     | The type of join to perform (e.g., 'inner', 'outer'). Defaults to 'cross'.|
    +------------------+----------+-----------+---------------------------------------------------------------+
    | pd_args          |   No     | Additional arguments for the Pandas merge function, if any.               |
    +------------------+----------+-----------+---------------------------------------------------------------+

Returns

    This component returns a DataFrame created by merging `df1` and `df2` based on the specified join type and arguments.
    It records metrics for the resulting DataFrame’s row and column counts. Any errors during merging are raised
    with detailed error messages, and additional debug information is available if debugging mode is enabled.


Example:

```yaml
tMerge:
  depends:
  - QueryToPandas_1
  - QueryToPandas_2
  type: cross
```