Repository navigation
Ignore labels absent from a cell in least_common - #78
Open
ZackaryLoevseth wants to merge 1 commit into
Open
ZackaryLoevseth wants to merge 1 commit into
ZackaryLoevseth wants to merge 1 commit into
Conversation
compute_mode counts with fill_value=-1, so a label missing from a cell got a count of -1 and idxmin returned it. Absent labels are now set to the count dtype's maximum before idxmin, which keeps the integer output dtype. The run-only test_least_common is replaced with the example from xarray-contrib#77.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #77.
compute_modecounts labels withfill_value=-1, so a label missing from a cell gets a count of −1 andidxminreturns it. For the anti-mode, absent labels are now set to the count dtype's maximum beforeidxmin, so they are never chosen and the result keeps the input's integer dtype. Masking them with NaN instead would turn every result into a float. An empty cell still gives the first label, asmost_commondoes.The run-only
test_least_commonis replaced with the example from #77 and checks the exact values and the dtype. It fails on main and passes with the change. The rest of the suite is unchanged: the only failures are the twotest_conservative_nan_thresholds_against_coarsencases that #76 marks as xfail. Ruff and mypy give the same findings as on main. I'll add the changelog line once #76 is in, since it adds the Unreleased section.