Skip to content

mecfs_bio.build_system.task.pipes.concat_str_pipe

Pipe to concatenate multiple string columns

Classes:

ConcatStrPipe

Bases: DataProcessingPipe

Pipe to concatenate multiple string columns

Methods:

Attributes:

ignore_nulls class-attribute instance-attribute

ignore_nulls: bool = True

new_col_name instance-attribute

new_col_name: str

sep instance-attribute

sep: str

target_cols instance-attribute

target_cols: Sequence[str]

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/concat_str_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    return x.with_columns(
        narwhals.concat_str(
            [narwhals.col(item) for item in self.target_cols],
            separator=self.sep,
            ignore_nulls=self.ignore_nulls,
        ).alias(self.new_col_name)
    )