Checks#

class checkedframe._checks.Check(func: Callable | None = None, columns: str | list[str] | Selector | None = None, input_type: CheckInputType = 'auto', return_type: CheckReturnType = 'auto', native: bool | Literal['auto'] = 'auto', name: str | None = None, description: str | None = None)#

Represents a check to run.

Parameters:
  • func (Optional[Callable], optional) – The check to run, by default None

  • columns (Optional[str | list[str]], optional) – The columns associated with the check, by default None

  • input_type (Optional[Literal["auto", "Frame", "Series"]], optional) – The input to the check function. If “auto”, attempts to determine via the context, by default “auto”

  • return_type (Literal["auto", "bool", "Expr", "Series"], optional) – The return type of the check function. If “auto”, attempts to determine via the return type annotation and number of arguments, by default “auto”

  • native (bool, optional) – Whether to run the check on the native DataFrame or the Narwhals DataFrame, by default True

  • name (Optional[str], optional) – The name of the check, by default None

  • description (Optional[str], optional) – The description of the check. If None, attempts to read from the __doc__ attribute, by default None

static approx_eq(other: Any, rtol: float = 1e-05, atol: float = 1e-08, nan_equal: bool = False) Check#

Tests whether all values in the Series are approximately equal to the given value.

Parameters:

other (Any)

Return type:

Check

static eq(other: Any) Check#

Tests whether all values in the Series are equal to the given value.

Parameters:

other (Any)

Return type:

Check

static ge(other: Any) Check#

Tests whether all values in the Series are greater than or equal to the given value.

Parameters:

other (Any)

Return type:

Check

static gt(other: Any) Check#

Tests whether all values in the Series are greater than the given value.

Parameters:

other (Any)

Return type:

Check

static is_between(lower_bound, upper_bound, closed: Literal['left', 'right', 'none', 'both'] = 'both') Check#

Tests whether all values of the Series are in the given range.

Parameters:
  • lower_bound (Any) – The lower bound

  • upper_bound (Any) – The upper bound

  • closed (ClosedInterval, optional) – Defines which sides of the interval are closed, by default “both”

Return type:

Check

static is_id(subset: str | list[str]) Check#

Tests whether the given column(s) identify the DataFrame.

Parameters:

subset (str | list[str]) – The columns that identify the DataFrame

Return type:

Check

static is_in(other: Collection) Check#

Tests whether all values of the Series are in the given collection.

Parameters:

other (Collection) – The collection

Return type:

Check

static le(other: Any) Check#

Tests whether all values in the Series are less than or equal to the given value.

Parameters:

other (Any)

Return type:

Check

static lt(other: Any) Check#

Tests whether all values in the Series are less than the given value.

Parameters:

other (Any)

Return type:

Check

class checkedframe._checks.staticproperty(func)#

A decorator that allows defining a read-only, class-level attribute that is computed by a function which takes no arguments (like a static method).