boilercv_pipeline.models.column#

Data column model.

Submodules#

Package Contents#

Classes#

Parts

Label parts.

Col

Column.

ConstCol

Constant column.

Transform

Column transformer.

LinkedCol

Column linked to a source.

IdentityCol

Column with a source the same as itself.

_Kind

Kind of column.

Functions#

get_parts

Get parts of a label.

get_name

Get name from parts.

get_latex

Get LaTeX-wrapped name from parts.

transform

Transform.

scale

Scale.

rename

Rename.

convert

Convert.

Data#

Kind

Kind of column.

API#

class boilercv_pipeline.models.column.Parts#

Bases: typing.NamedTuple

Label parts.

sym: str#

None

sub: str#

None

unit: str#

None

boilercv_pipeline.models.column.get_parts(
string: str,
) boilercv_pipeline.models.column.Parts#

Get parts of a label.

boilercv_pipeline.models.column.get_name(
p: boilercv_pipeline.models.column.Parts,
) str#

Get name from parts.

boilercv_pipeline.models.column.get_latex(
p: boilercv_pipeline.models.column.Parts,
) str#

Get LaTeX-wrapped name from parts.

class boilercv_pipeline.models.column.Col#

Column.

sym: str = <Multiline-String>#
unit: str = <Multiline-String>#
sub: str = <Multiline-String>#
raw: str = <Multiline-String>#
fmt: str | None#

None

__post_init__()#

Post-init.

__call__() str#

Get canonical name.

latex() str#

LaTeX name.

name() str#

Name.

property no_sub: boilercv_pipeline.models.column.Col#

Canonical name without subscript.

property no_unit: boilercv_pipeline.models.column.Col#

Canonical name without unit.

classmethod from_col(
col: boilercv_pipeline.models.column.Col,
) boilercv_pipeline.models.column.Col#

Build a column from a column.

classmethod only_raw(
name: str,
) boilercv_pipeline.models.column.Col#

Build a column without handling subscript and units.

rename(
df: pandas.DataFrame,
) pandas.DataFrame#

Rename this column.

class boilercv_pipeline.models.column.ConstCol#

Bases: boilercv_pipeline.models.column.Col

Constant column.

val: Any#

None

assign(
df: pandas.DataFrame,
) pandas.DataFrame#

Assign this column.

boilercv_pipeline.models.column.transform(
v: boilercv_pipeline.models.column.types.P,
src: boilercv_pipeline.models.column.Col,
dst: boilercv_pipeline.models.column.Col,
f: boilercv_pipeline.models.column.types.Transform[boilercv_pipeline.models.column.types.P, boilercv_pipeline.models.column.types.R, boilercv_pipeline.models.column.types.Ps],
/,
*args: boilercv_pipeline.models.column.types.Ps.args,
**kwds: boilercv_pipeline.models.column.types.Ps.kwargs,
) boilercv_pipeline.models.column.types.R#

Transform.

boilercv_pipeline.models.column.scale(
v: boilercv_pipeline.models.column.types.SupportsMul_T,
s: boilercv_pipeline.models.column.types.SupportsMul_T,
src: boilercv_pipeline.models.column.Col,
dst: boilercv_pipeline.models.column.Col,
) boilercv_pipeline.models.column.types.SupportsMul_T#

Scale.

class boilercv_pipeline.models.column.Transform#

Column transformer.

f: boilercv_pipeline.models.column.types.Transform[Any, Any, Any]#

None

args: tuple[Any]#

‘field(…)’

kwds: dict[str, Any]#

‘field(…)’

class boilercv_pipeline.models.column.LinkedCol#

Bases: boilercv_pipeline.models.column.Col

Column linked to a source.

source: boilercv_pipeline.models.column.Col#

‘field(…)’

rename(
df: pandas.DataFrame,
) pandas.DataFrame#

Rename this column.

convert(
df: pandas.DataFrame,
ureg: pint.UnitRegistry,
) pandas.DataFrame#

Convert this column.

class boilercv_pipeline.models.column.IdentityCol#

Bases: boilercv_pipeline.models.column.LinkedCol

Column with a source the same as itself.

__post_init__()#
boilercv_pipeline.models.column.rename(
df: pandas.DataFrame,
columns: list[boilercv_pipeline.models.column.LinkedCol],
) pandas.DataFrame#

Rename.

boilercv_pipeline.models.column.convert(
df: pandas.DataFrame,
cols: list[boilercv_pipeline.models.column.LinkedCol],
ureg: pint.UnitRegistry,
) pandas.DataFrame#

Convert.

class boilercv_pipeline.models.column._Kind(
/,
**data: typing.Any,
)#

Bases: pydantic.BaseModel

Kind of column.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

idx: str#

‘idx’

boilercv_pipeline.models.column.Kind#

‘_Kind(…)’

Kind of column.