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

Fix minimum and maximum in the presence of missing values #35989

Merged
merged 2 commits into from
Jun 8, 2020
Merged

Conversation

nalimilan
Copy link
Member

Another, possibly cleaner way of fixing this would be to add an isnan(::Number) = false fallback, and do x isa Number && isnan(x). That would make the code a bit clearer and could be useful for others. Currently we would have to do x isa Union{Real, Complex} && isnan(x) since there are the only types for which we define isnan methods -- but that approach wouldn't work for custom complex types.

Similar to #35323 (but simpler to fix).

@nalimilan nalimilan added the missing data Base.missing and related functionality label May 22, 2020
base/reduce.jl Outdated
v2 == v2 || return v2
v3 == v3 || return v3
v4 == v4 || return v4
# === true is there to ignore missing
Copy link
Member Author

Choose a reason for hiding this comment

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

"ignore" isn't the right term actually since we short-circuit. I can change this to just add "or missing" to the existing comment for NaN.

Copy link
Member

Choose a reason for hiding this comment

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

Just say something like "to handle missing"

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually "short-circuit" is even more accurate I think.

Copy link
Member

@tkf tkf left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing data Base.missing and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants