many times in generic code i use stuff like: x > eps(x), if for some reason x happens to be a missing value, then i get a nasty error unless i define:
Base.eps(::Missing) = missing
is this a good idea? if so it could be default behavior in Base.
Pull Request: https://github.com/JuliaLang/julia/pull/32235
so x>Missing
is always true
?
x > missing
is missing
. So if that's used in a boolean context, it doesn't help.
I just think it makes sense to throw an error here, maybe just clean the data or check x===Missing
I think it still makes sense to add the method, since missing
already propagates through many unary/binary functions of floats.
@JeffBezanson : my use case ofcourse is unimportant and irrelevant in the decision, but i needed to apply almost exactly that inequality by broadcasting on an array and i expected to get a Array{Union{Missing, Bool},1}
but the method eps(::Missing)
was missing :smiley:
@Moelf : data cannot always be simply cleaned, for example in a dataframe where a row has only partially missing
information, to clean the data i should discard the whole row or coerce the missing
to something else.
data cannot always be simply cleaned, for example in a dataframe where a row has only partially missing information, to clean the data i should discard the whole row or coerce the missing to something else.
You just apply the function to the non missing elements.
Also don't forget
lift(f) = x -> ismissing(x) ? missing : f(x)
Closing based on discussion in https://github.com/JuliaLang/julia/pull/32235.
Most helpful comment
Also don't forget