Skip to content

Row Constraints API

NotNull

ydata.constraints.rows.constraint.NotNull

Bases: RowConstraint

Check that values in the specified columns are not null.

Parameters:

Name Type Description Default
columns str | list[str]

Column(s) that must not contain null / NaN values.

required
name str | None

Human-readable label shown in engine summaries.

None

Unique

ydata.constraints.rows.constraint.Unique

Bases: RowConstraint

Check that values in the specified columns contain no duplicates.

A row is flagged as violating when its value appears more than once in that column. This is the standard uniqueness / primary-key check.

Parameters:

Name Type Description Default
columns str | list[str]

Column(s) whose values must be unique.

required
name str | None

Human-readable label shown in engine summaries.

None

GreaterThan

ydata.constraints.rows.constraint.GreaterThan

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

LowerThan

ydata.constraints.rows.constraint.LowerThan

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

Between

ydata.constraints.rows.constraint.Between

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

Positive

ydata.constraints.rows.constraint.Positive

Bases: GreaterThan

validate(dataset)

Validate the constraint against a dataset.

Parameters:

Name Type Description Default
dataset Dataset

Dataset to test

required

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

NotIncludedIn

ydata.constraints.rows.constraint.NotIncludedIn

Bases: RowConstraint

Check that values in a column are NOT in a specified blocklist.

This is the complement of :class:IncludedIn — rows containing any of the forbidden values are flagged as violations.

Parameters:

Name Type Description Default
column str

Column on which the constraint is applied.

required
values list[Any] | Any

Single value or list of values that are not allowed.

required
name str | None

Human-readable label shown in engine summaries.

None

IncludedIn

ydata.constraints.rows.constraint.IncludedIn

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

StringLength

ydata.constraints.rows.constraint.StringLength

Bases: RowConstraint

Check that string values in the specified columns have an acceptable length.

Length is measured in characters after coercing to str. Both bounds are inclusive. Omit max_length to only enforce a minimum.

Parameters:

Name Type Description Default
columns str | list[str]

Column(s) to check.

required
min_length int

Minimum allowed string length (inclusive). Defaults to 0.

0
max_length int | None

Maximum allowed string length (inclusive). None means no upper bound.

None
name str | None

Human-readable label shown in engine summaries.

None

Monotonic

ydata.constraints.rows.constraint.Monotonic

Bases: RowConstraint

Check that values in a column are monotonically ordered.

Row i is flagged as violating when it breaks the ordering relative to row i-1. The first row always passes (no predecessor to compare to).

Works with numeric and datetime columns. For strictly increasing/decreasing sequences, equal consecutive values are treated as violations.

Parameters:

Name Type Description Default
columns str | list[str]

Column(s) to check.

required
increasing bool

If True (default), values must be non-decreasing. If False, values must be non-increasing.

True
strict bool

If True, equal consecutive values are violations (strictly monotonic). Defaults to False.

False
name str | None

Human-readable label shown in engine summaries.

None

Regex

ydata.constraints.rows.constraint.Regex

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

BetweenDates

ydata.constraints.rows.constraint.BetweenDates

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

RelationConstraint

ydata.constraints.rows.constraint.RelationConstraint

Bases: RowConstraint

Validates that each row's key (matching columns) and value columns match a reference. Key columns must be single values; value columns can be scalar or list of allowed values per key in the reference.

validate(dataset)

Validate the constraint against a dataset.

Parameters:

Name Type Description Default
dataset Dataset

Dataset to test

required

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask (True = satisfied, False = violated)

CombineConstraints

ydata.constraints.rows.constraint.CombineConstraints

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Args: dataset (Dataset): Dataset to test

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask

RowCustomConstraint

ydata.constraints.rows.constraint.RowCustomConstraint

Bases: RowConstraint

validate(dataset)

Validate the constraint against a dataset.

Parameters:

Name Type Description Default
dataset Dataset

Dataset to test

required

Returns:

Name Type Description
pdDataFrame DataFrame

constraint mask