Skip to content

Commit

Permalink
Fix test failures on master
Browse files Browse the repository at this point in the history
Use vcat() instead of collect() in colwise(), and identity() instead of abs(),
since the latter do not work with Nullable.
  • Loading branch information
nalimilan committed Sep 27, 2016
1 parent 5998148 commit 786414c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/groupeddataframe/grouping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ colwise(sum, groupby(df, :a))
```
"""
colwise(f::Function, d::AbstractDataFrame) = Any[collect(f(d[idx])) for idx in 1:size(d, 2)]
colwise(f::Function, d::AbstractDataFrame) = Any[vcat(f(d[idx])) for idx in 1:size(d, 2)]
colwise(f::Function, gd::GroupedDataFrame) = map(colwise(f), gd)
colwise(f::Function) = x -> colwise(f, x)
colwise(f) = x -> colwise(f, x)
# apply several functions to each column in a DataFrame
colwise{T<:Function}(fns::Vector{T}, d::AbstractDataFrame) = Any[collect(f(d[idx])) for f in fns, idx in 1:size(d, 2)][:]
colwise{T<:Function}(fns::Vector{T}, d::AbstractDataFrame) = Any[vcat(f(d[idx])) for f in fns, idx in 1:size(d, 2)][:]
colwise{T<:Function}(fns::Vector{T}, gd::GroupedDataFrame) = map(colwise(fns), gd)
colwise{T<:Function}(fns::Vector{T}) = x -> colwise(fns, x)

Expand Down
2 changes: 1 addition & 1 deletion test/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module TestData
end
@test isequal(res, sum(df7[:d1]))

@test aggregate(DataFrame(a=1),abs) == DataFrame(a_abs=1)
@test aggregate(DataFrame(a=1), identity) == DataFrame(a_identity=1)

df8 = aggregate(df7[[1, 3]], sum)
@test isequal(df8[1, :d1_sum], sum(df7[:d1]))
Expand Down

0 comments on commit 786414c

Please sign in to comment.