Implementation:Sdv dev SDV Range Init
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Data_Quality, Constraint_Satisfaction |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Concrete tool for enforcing three-column range constraints in synthetic data, provided by the SDV library.
Description
The Range constraint ensures that middle_column_name values fall between low_column_name and high_column_name. Supports numerical and datetime columns.
Usage
Create a Range instance and add it to a synthesizer.
Code Reference
Source Location
- Repository: SDV
- File: sdv/cag/range.py
- Lines: L28-108
Signature
class Range(BaseConstraint):
def __init__(
self,
low_column_name,
middle_column_name,
high_column_name,
strict_boundaries=True,
table_name=None,
):
"""
Args:
low_column_name (str): Lower bound column.
middle_column_name (str): Column that must be between bounds.
high_column_name (str): Upper bound column.
strict_boundaries (bool): Use strict < comparison. Defaults to True.
table_name (str or None): Target table (multi-table). Defaults to None.
"""
Import
from sdv.cag import Range
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| low_column_name | str | Yes | Lower bound column |
| middle_column_name | str | Yes | Column that must be between bounds |
| high_column_name | str | Yes | Upper bound column |
| strict_boundaries | bool | No | Use strict < comparison (default: True) |
| table_name | str or None | No | Target table for multi-table |
Outputs
| Name | Type | Description |
|---|---|---|
| instance | Range | Constraint object ready to add to a synthesizer |
Usage Examples
from sdv.cag import Range
constraint = Range(
low_column_name='min_price',
middle_column_name='actual_price',
high_column_name='max_price',
strict_boundaries=True,
)
synthesizer.add_constraints([constraint])
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment