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

Incorrect rounding in Custom Constraint example #941

Closed
npatki opened this issue Aug 8, 2022 · 0 comments · Fixed by #942
Closed

Incorrect rounding in Custom Constraint example #941

npatki opened this issue Aug 8, 2022 · 0 comments · Fixed by #942
Assignees
Labels
bug Something isn't working documentation Docs, user guides or API feature:constraints Related to inputting rules or business logic
Milestone

Comments

@npatki
Copy link
Contributor

npatki commented Aug 8, 2022

If I follow the exact code in the Custom Constraint User Guide, the resulting constraint doesn't work as intended -- it never produces employees that are not constractors.

The issue is in the reverse_transform method. Instead of round(2) the code should be round().

i.e. change this line

rounded_data = transformed_data[is_included][column_name].round()

Further Context

In previous versions of the docs, we were multiplying by the increment first. Now, we are multiplying by the increment last. Therefore, it is necessary to round to the nearest whole number instead of 2 digits.

@npatki npatki added bug Something isn't working documentation Docs, user guides or API feature:constraints Related to inputting rules or business logic labels Aug 8, 2022
@amontanez24 amontanez24 self-assigned this Aug 16, 2022
@amontanez24 amontanez24 added this to the 0.17.0 milestone Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Docs, user guides or API feature:constraints Related to inputting rules or business logic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants