-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
julia> mean(skipmissing([missing, missing]))
ERROR: MethodError: reduce_empty(::typeof(Base.add_sum), ::Type{Union{}}) is ambiguous. Candidates:
reduce_empty(::typeof(Base.add_sum), ::Type{T}) where T<:Union{Int16, Int32, Int8} in Base at reduce.jl:231
reduce_empty(::typeof(Base.add_sum), ::Type{T}) where T<:Union{UInt16, UInt32, UInt8} in Base at reduce.jl:232
Possible fix, define
reduce_empty(::typeof(Base.add_sum), ::Type{Union{}})
Stacktrace:
[1] mapreduce_empty(::typeof(identity), ::Function, ::Type) at ./reduce.jl:247
[2] mapreduce_empty_iter(::Function, ::Function, ::Base.SkipMissing{Array{Missing,1}}, ::Base.HasEltype) at ./reduce.jl:254
[3] mean(::typeof(identity), ::Base.SkipMissing{Array{Missing,1}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:60
[4] mean(::Base.SkipMissing{Array{Missing,1}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:42
[5] top-level scope at REPL[110]:1
People use skipmissing to get away from worrying about missings. They shouldn't have to worry about whether or not the vector they are working with is full of missing values.
xref #35050. I would consider this part of a larger set of PRs I have in mind to make working with missings easier.
CameronBieganek
Metadata
Metadata
Assignees
Labels
No labels