Skip to content

mecfs_bio.build_system.task.pipes.cast_pipe

Classes:

CastPipe

Bases: DataProcessingPipe

Methods:

Attributes:

new_col_name instance-attribute

new_col_name: str

target_column instance-attribute

target_column: str

type instance-attribute

type: DType

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/cast_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    return x.with_columns(
        narwhals.col(self.target_column).cast(self.type).alias(self.new_col_name)
    )