Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/abstractdataframe/abstractdataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,19 @@ function get_stats(@nospecialize(col::Union{AbstractVector, Base.SkipMissing}),
stats::AbstractVector{Symbol})
d = Dict{Symbol, Any}()

if :q25 in stats || :median in stats || :q75 in stats
q = try quantile(col, [.25, .5, .75]) catch; (nothing, nothing, nothing) end
d[:q25] = q[1]
d[:median] = q[2]
d[:q75] = q[3]
if eltype(col) <: Union{Missing, AbstractString}
d[:q25] = d[:median] = d[:q75] = nothing
elseif :q25 in stats || :median in stats || :q75 in stats
mcol = Base.copymutable(col)
if :q25 in stats
d[:q25] = try quantile!(mcol, 0.25) catch; nothing; end
end
if :median in stats
d[:median] = try quantile!(mcol, 0.50) catch; nothing; end
end
if :q75 in stats
d[:q75] = try quantile!(mcol, 0.75) catch; nothing; end
end
end

if :min in stats || :max in stats
Expand Down