Skip to content

Select

matchlab.transformers.select

Select projects. Keep the named columns, drop the rest.

Classes:

  • Select

    Keep only the named columns, plus id.

Select

Select(*columns: str, **data: object)

Bases: Transformer


              flowchart TD
              matchlab.transformers.select.Select[Select]
              matchlab.transformers.base.Transformer[Transformer]

                              matchlab.transformers.base.Transformer --> matchlab.transformers.select.Select
                


              click matchlab.transformers.select.Select href "" "matchlab.transformers.select.Select"
              click matchlab.transformers.base.Transformer href "" "matchlab.transformers.base.Transformer"
            

Keep only the named columns, plus id.

Projection is Select's one job. Naming a column keeps it, and every column you do not name is dropped. id survives whether or not you name it, since it is the grouping a model matches on. Columns are the source-qualified names (crn_company).

Take the columns to keep positionally, e.g. Select('crn_company').

Methods:

  • apply

    Project to id and the named columns, in that order.

Attributes:

version class-attribute

version: int = 1

columns class-attribute instance-attribute

columns: tuple[str, ...] = Field(default=(), description='The columns to keep, by their current (qualified) names.')

model_config class-attribute instance-attribute

model_config = ConfigDict(extra='forbid', frozen=True)

apply

apply(data: DataFrame) -> DataFrame

Project to id and the named columns, in that order.