def partition(attrs, df, partitions):
    """
    Returns the number of equivilence classes for the columns represented
    in attrs for dataframe df.
    """
    if attrs in partitions:
        return partitions[attrs]
    shape = df.drop_duplicates(attrs).shape[0]
    partitions[attrs] = shape
    return shape