Config#

class checkedframe._config.Config(columns: str | Iterable[str] | Selector, **kwargs: Unpack[_PossibleConfigs])#

See apply_configs() for how this class is used.

Parameters:
  • columns (str | Iterable[str] | Selector) – The columns to apply the configuration to

  • **kwargs (Unpack[_PossibleConfigs]) –

    Valid keyword arguments are:

    nullablebool

    Whether the column is nullable or not

    requiredbool

    Whether the column is required to exist or not

    castbool

    Whether to cast to the specified datatype

    allow_nanbool

    Whether the column can have NaNs or not

    allow_infbool

    Whether the column can have inf/-inf or not

checkedframe._config.apply_configs(*args: Config)#

Change the configuration options of columns.

Note

Config changes done by apply_configs will overwrite per-column configurations.

Examples

import checkedframe as cf
import checkedframe.selectors as cfs
import polars as pl

@cf.apply_configs(
    cf.Config(cfs.float(), allow_nan=True)
)
class S(cf.Schema):
    check_bal = cf.Float64()
    sav_bal = cf.Float64(allow_nan=False)


df = pl.DataFrame({"check_bal": [100.4, float("nan")], "sav_bal": [88.99, float("nan")]})
S.validate(df)  # passes!