Inequality

Compatibility: A pair of numerical columns or a pair of datetime columns

The Inequality constraint enforces an inequality relationship between a pair of columns. For every row, the value in one column must be greater than a value in another.

Parameters

(required) low_column_name: The name of the column whose values must be lower

(required) high_column_name: The name of the column whose values must be greater

strict_boundaries: Whether the high column must be strictly greater than the low column

(default) True

The value in the high column must be strictly greater than the value in the low column

False

The value in the high column must be greater than or equal to the value in the low column.

Example

Define your constraint using the parameters and then add it to a synthesizer.

my_constraint = {
    'constraint_class': 'Inequality',
    'table_name': 'guests', # for multi table synthesizers
    'constraint_parameters': {
        'low_column_name': 'checkin_date',
        'high_column_name': 'checkout_date',
        'strict_boundaries': True
    }
}

my_synthesizer.add_constraints(constraints=[
    my_constraint
])

FAQs

What happens to missing values?

This constraint ignores missing values. The constraint considered is valid as long as the numerical values (non-missing values) follow the inequality.

What if I want to compare a column to a single, fixed value?

Use the ScalarInequality constraint to compare a column to a single value that is constant.

Last updated

Copyright (c) 2023, DataCebo, Inc.