MaxGroupsPerID#

from tmlt.analytics import MaxGroupsPerID
class tmlt.analytics.MaxGroupsPerID(grouping_column, max)#

Bases: Constraint

A constraint limiting the number of distinct groups per ID.

This constraint limits how many times a distinct value may appear in the grouping column for each distinct value in the table’s ID column. For example, MaxGroupsPerID("grouping_column", 4) guarantees that there are at most four distinct values of grouping_column for each distinct value of ID_column.

grouping_column: str#

The name of the grouping column.

max: int#

The maximum number of distinct values in the grouping column for each distinct value in the ID column.

__post_init__()#

Check constructor arguments.