JuliaData / SplitApplyCombine.jl

Split-apply-combine strategies for Julia
Other
149 stars 15 forks source link

Use Dictionaries.jl for grouping #21

Closed andyferris closed 4 years ago

andyferris commented 4 years ago

This moves group and family over to use Dictionaries.jl for return type. This resolves a long-standing issue I had with group where I wanted to do operations like the second one below:

julia> group(iseven, 1:10)
2-element Dictionaries.HashDictionary{Bool,Array{Int64,1}}
 false │ [1, 3, 5, 7, 9]
  true │ [2, 4, 6, 8, 10]

julia> sum.(group(iseven, 1:10))  # This is new
2-element Dictionaries.HashDictionary{Bool,Int64}
 false │ 25
  true │ 30

julia> groupreduce(iseven, +, 1:10)
2-element Dictionaries.HashDictionary{Bool,Int64}
 false │ 25
  true │ 30

Feedback welcome.

There is a little bit more to do:

codecov-io commented 4 years ago

Codecov Report

Merging #21 into master will decrease coverage by 3.46%. The diff coverage is 56.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #21      +/-   ##
==========================================
- Coverage      75%   71.53%   -3.47%     
==========================================
  Files          10       10              
  Lines         368      404      +36     
==========================================
+ Hits          276      289      +13     
- Misses         92      115      +23
Impacted Files Coverage Δ
src/only.jl 90% <ø> (ø)
src/product.jl 90.47% <ø> (ø) :arrow_up:
src/SplitApplyCombine.jl 50% <0%> (ø) :arrow_up:
src/innerjoin.jl 55.31% <100%> (ø) :arrow_up:
src/map.jl 54.54% <42.85%> (-7.53%) :arrow_down:
src/group.jl 53.91% <52.29%> (-13.23%) :arrow_down:
src/leftgroupjoin.jl 92.59% <93.33%> (+36.77%) :arrow_up:
src/combinedims.jl 50% <0%> (-18.19%) :arrow_down:
src/splitdims.jl 84.44% <0%> (-2.23%) :arrow_down:
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e7a12e2...a7c85c2. Read the comment docs.