Skip to content

Tpluckcols

flowtask.components.tPluckCols

tPluckCols

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

Bases: tPandas

tPluckCols

Overview

    The tPluckCols class is a component for selecting a specific subset of columns from a Pandas DataFrame.
    It provides a streamlined way to filter columns, allowing only specified columns to be retained in the output.

.. table:: Properties
:widths: auto

    +-------------+----------+-----------+---------------------------------------------------------------+
    | Name        | Required | Summary                                                                   |
    +-------------+----------+-----------+---------------------------------------------------------------+
    | columns     |   Yes    | A list of column names to retain in the DataFrame.                        |
    +-------------+----------+-----------+---------------------------------------------------------------+

Returns

    This component returns a Pandas DataFrame containing only the specified columns listed in `columns`.
    If no columns are provided, it raises an error. The resulting DataFrame is a copy to ensure
    any modifications do not affect the original DataFrame.


Example:

```yaml
tPluckCols:
  depends:
  - TransformRows_11
  columns:
  - location_code
  - ss_market
  - store_id
  - store_number
  - company_id
  - pt_ft
  - is_covered
  - endcap
  - rev_band
  - comparison_store
```

start async

start(**kwargs)

Obtain Pandas Dataframe.