Value#

synthesized.common.rules.Value

class Value(value)#

Represents a value of a table when constructing GenericRules

Example

>>> from synthesized.common.rules import Equals, Column, Value
>>> genericrule = Equals(Column("A"), Value(10))

Will create a rule that only synthesizes rows where column “A” is equal to 10`.

Methods

filter(df)

Remove rows in a dataframe that are not valid under the rule.

get_augment_func(inverse, **kwargs)

Return the functions needed to augment the dataframe so that the rule is covered.

get_children()

rtype

List[GenericRule]

set_meta(df_meta)

to_pd_str(df_name)

Get the pandas statement to be evaluated for this rule

to_sql_str()

Get the SQL statement to be evaluated for this rule

filter(df)#

Remove rows in a dataframe that are not valid under the rule.

Parameters

df (pd.DataFrame) – Data to filter.

Return type

DataFrame

Returns

DataFrame with rows removed that are not valid under the rule.

get_augment_func(inverse, **kwargs)#

Return the functions needed to augment the dataframe so that the rule is covered.

The returned object is a Dict[str, Callable], where keys are the columns where the result of the function in the values will be applied.

For example, if get_augment_func returns {col_name: func}, it will be applied as >>> df[col_name] = df.apply(func, axis=1)

Return type

Dict[str, Callable]

to_pd_str(df_name)#

Get the pandas statement to be evaluated for this rule

Return type

str

to_sql_str()#

Get the SQL statement to be evaluated for this rule

Return type

str