sdv.constraints.Positive

class sdv.constraints.Positive(column_name, strict=False)[source]

Ensure the column_name column is greater than zero.

The transformation works by applying a logarithm to the column_name + 1 to ensure that the value stays positive when reverted afterwards using an exponential.

Parameters
  • column_name (str) – The name of the column that is constrained to be positive.

  • strict (bool) – Whether the comparison of the values should be strict; disclude zero > or include it >=.

__init__(column_name, strict=False)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(column_name[, strict])

Initialize self.

filter_valid(table_data)

Get only the rows that are valid.

fit(table_data)

Fit Constraint class to data.

fit_transform(table_data)

Fit this Constraint to the data and then transform it.

from_dict(constraint_dict)

Build a Constraint object from a dict.

is_valid(table_data)

Say whether high is greater than low in each row.

reverse_transform(table_data)

Handle logic around reverse transforming constraints.

to_dict()

Return a dict representation of this Constraint.

transform(table_data)

Perform necessary transformations needed by constraint.

Attributes

constraint_columns