Skip to content

mecfs_bio.build_system.task.pipes.unpivot_pipe

Pipe to convert dataframe from wide to long format.

Classes:

UnPivotPipe

Bases: DataProcessingPipe

Methods:

Attributes:

index instance-attribute

index: str | list[str] | None

on instance-attribute

on: str | list[str] | None

value_name instance-attribute

value_name: str

variable_name instance-attribute

variable_name: str

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/unpivot_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    return x.unpivot(
        on=self.on,
        index=self.index,
        variable_name=self.variable_name,
        value_name=self.value_name,
    )