ConstraintEngine
ydata.constraints.engine.ConstraintEngine
add_constraint(constraint)
Add a single constraint to the engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
constraint
|
Constraint
|
A constraint |
required |
add_constraints(constraints)
Add some constraint to the engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
constraints
|
List[Constraint]
|
List of constraints |
required |
explain_constraints()
filter(dataset)
Return a new Dataset with only the rows that pass all row constraints.
Filtering is based on row constraints only; column constraints are still reported in summary() but do not remove rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
Dataset to filter. Will be validated if the engine has not been validated yet. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dataset |
Dataset
|
New Dataset containing only rows that satisfy every row constraint. If there are no row constraints, returns the dataset unchanged. |
summary(include_rows=False)
validate(dataset)
Validate the engine against a dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
Dataset against which to validate the constraints |
required |