-
Notifications
You must be signed in to change notification settings - Fork 86
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
Added parameter to InvalidTargetDataCheck to show only top unique values rather than all unique values #1485
Conversation
InvalidTargetDataCheck
to show only top unique values rather than all unique values
InvalidTargetDataCheck
to show only top unique values rather than all unique values
Codecov Report
@@ Coverage Diff @@
## main #1485 +/- ##
=========================================
+ Coverage 100.0% 100.0% +0.1%
=========================================
Files 223 223
Lines 15135 15158 +23
=========================================
+ Hits 15128 15151 +23
Misses 7 7
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@angela97lin I think this is good to merge! Thank you!
if self.n_unique is None: | ||
details = {"target_values": unique_values} | ||
else: | ||
details = {"target_values": unique_values[:min(self.n_unique, len(unique_values))]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit-pick: I think the min
is redundant because if the end of the slice is larger than the list length, you'll get the whole list anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think if self.n_unique > len(unique_values), you get an IndexError
? Though I think I should have written len(unique_values)-1` on second thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you'd get the index error when you slice a list. But it's a minor point and what you have now works and is clear!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah, TIL slicing is magical and will just give you the whole list, thanks @freddyaboulton :')
(Will likely still keep this/something similar for clarity sake though)
Closes #1460