Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dandavison
dandavison / gist:4780d40a866e0b942ff9
Last active August 29, 2015 14:18
One-to-one question

Two columns satisfy a "one-to-one" constraint if each value in column 1 is associated with exactly one value in column 2, and vice versa. E.g. in this data, the person column and the email column satisfy a one-to-one constraint:

>>> table = [('pablo', 'ppicasso@gmail.com'),
             ('georgia', 'gokeefe@hotmail.com'),
    	     ('mark', 'mrothko@aol.com')]
>>> is_one_to_one(table)