Base Utilities#
Dependency-free primitives shared by the other corr_vars.utils submodules: frame
introspection, expression coercion, and offset normalisation.
Expressions#
Frame Introspection#
- corr_vars.utils.base.columns(value)[source]#
- Parameters:
value (
DataFrame|LazyFrame)- Return type:
list[str]
- corr_vars.utils.base.struct_fields(value, field)[source]#
- Parameters:
value (pl.DataFrame | pl.LazyFrame)
field (ColumnNameOrSelector)
- Return type:
list[str]
- corr_vars.utils.base.col_length(value)[source]#
- Parameters:
value (
DataFrame|LazyFrame)- Return type:
int
Offsets#
- corr_vars.utils.base.normalize_offset(offset)[source]#
Coerce an offset to the polars duration language.
A polars-duration string (
"28d","6h") is returned unchanged; atimedeltais rendered in microseconds. This is the single place that turns anOffsetLikeinto the stringdt.offset_byneeds — which does not accept a timedelta.- Parameters:
offset (
str|timedelta)- Return type:
str