keywords arguments of same length as series get grouped

This commit is contained in:
Pietro Vertechi 2017-08-21 14:30:44 +01:00
parent c76855698e
commit 9529246bfb
2 changed files with 8 additions and 1 deletions

View File

@ -854,7 +854,7 @@ end
# expecting a mapping of "group label" to "group indices" # expecting a mapping of "group label" to "group indices"
function extractGroupArgs{T, V<:AVec{Int}}(idxmap::Dict{T,V}, args...) function extractGroupArgs{T, V<:AVec{Int}}(idxmap::Dict{T,V}, args...)
groupLabels = sortedkeys(idxmap) groupLabels = sortedkeys(idxmap)
groupIds = VecI[collect(idxmap[k]) for k in groupLabels] groupIds = Vector{Int}[collect(idxmap[k]) for k in groupLabels]
GroupBy(groupLabels, groupIds) GroupBy(groupLabels, groupIds)
end end

View File

@ -515,6 +515,13 @@ end
@series begin @series begin
label --> string(glab) label --> string(glab)
idxfilter --> groupby.groupIds[i] idxfilter --> groupby.groupIds[i]
for (key,val) in d
length(args) == 0 && break
if key != :group && isa(val, AbstractArray) && size(val,1) == size(args[1],1)
n = ndims(val)
:($key) := val[groupby.groupIds[i], fill(Colon(), n-1)...]
end
end
args args
end end
end end