Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Unique Constraint #540

Merged
merged 6 commits into from
Aug 5, 2021
Merged

Create Unique Constraint #540

merged 6 commits into from
Aug 5, 2021

Conversation

amontanez24
Copy link
Contributor

@amontanez24 amontanez24 commented Aug 2, 2021

resolve #532

This PR adds a new constraint class called Unique. The class takes in one parameter for its __init__: columns which is either a string defining the one column name that needs to be unique or a list of column names.

The Unique constraint only works with the reject_sampling handling_strategy. For this reason it only implements a is_valid method.

The is_valid method returns a pd.Series where the index corresponding to the first occurrence of a unique value for the specified columns is set to True, and the rest are set to False.

@amontanez24 amontanez24 marked this pull request as ready for review August 3, 2021 23:11
@amontanez24 amontanez24 requested a review from csala August 4, 2021 16:03
Copy link
Contributor

@csala csala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go!

@csala csala requested review from pvk-developer and sarahmish and removed request for pvk-developer August 4, 2021 19:01
Copy link
Contributor

@sarahmish sarahmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amontanez24 amontanez24 merged commit 8e3ae3b into master Aug 5, 2021
@amontanez24 amontanez24 deleted the sdv-issue-532-unique branch August 5, 2021 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Unique Constraint
3 participants