Skip to content

Commit

Permalink
sync with DataFrames 0.21 release
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins authored May 6, 2020
1 parent 7a34237 commit b8f3524
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DataFramesMeta"
uuid = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"
version = "0.5.0"
version = "0.5.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand All @@ -17,5 +17,5 @@ test = ["Lazy", "Random", "Statistics", "Test"]

[compat]
julia = "1"
DataFrames = ">= 0.19"
Tables = ">= 0.2.3"
DataFrames = "0.21"
Tables = "1"
46 changes: 23 additions & 23 deletions src/DataFramesMeta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,29 +214,29 @@ julia> df = DataFrame(x = 1:3, y = [2, 1, 2]);
julia> x = [2, 1, 0];
julia> @where(df, :x .> 1)
2×2 DataFrames.DataFrame
2×2 DataFrame
│ Row │ x │ y │
├─────┼───┼───┤
│ 1 │ 2 │ 1 │
│ 2 │ 3 │ 2 │
julia> @where(df, :x .> x)
2×2 DataFrames.DataFrame
2×2 DataFrame
│ Row │ x │ y │
├─────┼───┼───┤
│ 1 │ 2 │ 1 │
│ 2 │ 3 │ 2 │
julia> @where(df, :x .> x, :y .== 3)
0×2 DataFrames.DataFrame
0×2 DataFrame
julia> d = DataFrame(n = 1:20, x = [3, 3, 3, 3, 1, 1, 1, 2, 1, 1,
2, 1, 1, 2, 2, 2, 3, 1, 1, 2]);
julia> g = groupby(d, :x);
julia> @where(d, :x .== 3)
5×2 DataFrames.DataFrame
5×2 DataFrame
│ Row │ n │ x │
├─────┼────┼───┤
│ 1 │ 1 │ 3 │
Expand All @@ -246,9 +246,9 @@ julia> @where(d, :x .== 3)
│ 5 │ 17 │ 3 │
julia> @where(g, length(:x) > 5) # pick out some groups
DataFrames.GroupedDataFrame 2 groups with keys: Symbol[:x]
GroupedDataFrame 2 groups with keys: Symbol[:x]
First Group:
9×2 DataFrames.SubDataFrame{Array{Int64,1}}
9×2 SubDataFrame{Array{Int64,1}}
│ Row │ n │ x │
├─────┼────┼───┤
│ 1 │ 5 │ 1 │
Expand All @@ -262,7 +262,7 @@ First Group:
│ 9 │ 19 │ 1 │
Last Group:
6×2 DataFrames.SubDataFrame{Array{Int64,1}}
6×2 SubDataFrame{Array{Int64,1}}
│ Row │ n │ x │
├─────┼────┼───┤
│ 1 │ 8 │ 2 │
Expand Down Expand Up @@ -337,9 +337,9 @@ julia> d = DataFrame(n = 1:20, x = [3, 3, 3, 3, 1, 1, 1, 2, 1, 1,
julia> g = groupby(d, :x);
julia> @orderby(g, mean(:n))
DataFrames.GroupedDataFrame 3 groups with keys: Symbol[:x]
GroupedDataFrame 3 groups with keys: Symbol[:x]
First Group:
5×2 DataFrames.SubDataFrame{Array{Int64,1}}
5×2 SubDataFrame{Array{Int64,1}}
│ Row │ n │ x │
├─────┼────┼───┤
│ 1 │ 1 │ 3 │
Expand All @@ -349,7 +349,7 @@ First Group:
│ 5 │ 17 │ 3 │
Last Group:
6×2 DataFrames.SubDataFrame{Array{Int64,1}}
6×2 SubDataFrame{Array{Int64,1}}
│ Row │ n │ x │
├─────┼────┼───┤
│ 1 │ 8 │ 2 │
Expand Down Expand Up @@ -498,7 +498,7 @@ julia> using DataFramesMeta, DataFrames
julia> df = DataFrame(A = 1:3, B = [2, 1, 2]);
julia> @transform(df, a = 2 * :A, x = :A .+ :B)
3×4 DataFrames.DataFrame
3×4 DataFrame
│ Row │ A │ B │ a │ x │
├─────┼───┼───┼───┼───┤
│ 1 │ 1 │ 2 │ 2 │ 3 │
Expand All @@ -521,7 +521,7 @@ end
function based_on_helper(x, args...)
with_args =
with_anonymous(:($DataFrame($(map(replace_equals_with_kw, args)...))))
:( DataFrames.DataFrame(map($with_args, $x)))
:(DataFrames.combine($with_args, $x))
end

"""
Expand All @@ -546,15 +546,15 @@ julia> d = DataFrame(
julia> g = groupby(d, :x);
julia> @based_on(g, nsum = sum(:n))
3×2 DataFrames.DataFrame
3×2 DataFrame
│ Row │ x │ nsum │
├─────┼───┼──────┤
│ 1 │ 1 │ 99 │
│ 2 │ 2 │ 84 │
│ 3 │ 3 │ 27 │
julia> @based_on(g, x2 = 2 * :x, nsum = sum(:n))
20×3 DataFrames.DataFrame
20×3 DataFrame
│ Row │ x │ x2 │ nsum │
├─────┼───┼────┼──────┤
│ 1 │ 1 │ 2 │ 99 │
Expand Down Expand Up @@ -589,8 +589,8 @@ end
##############################################################################

function by_helper(x, what, args...)
:($by($x, $what,
$(with_anonymous(:($DataFrame($(map(replace_equals_with_kw, args)...)))))))
:(DataFrames.combine($(with_anonymous(:($DataFrame($(map(replace_equals_with_kw, args)...))))),
DataFrames.groupby($x, $what)))
end

"""
Expand Down Expand Up @@ -619,7 +619,7 @@ julia> df = DataFrame(
c = randn(8));
julia> @by(df, :a, d = sum(:c))
4×2 DataFrames.DataFrame
4×2 DataFrame
│ Row │ a │ d │
├─────┼───┼──────────┤
│ 1 │ 1 │ 1.27638 │
Expand All @@ -628,7 +628,7 @@ julia> @by(df, :a, d = sum(:c))
│ 4 │ 4 │ -2.42621 │
julia> @by(df, :a, d = 2 * :c)
8×2 DataFrames.DataFrame
8×2 DataFrame
│ Row │ a │ d │
├─────┼───┼───────────┤
│ 1 │ 1 │ 1.22982 │
Expand All @@ -641,7 +641,7 @@ julia> @by(df, :a, d = 2 * :c)
│ 8 │ 4 │ -1.78806 │
julia> @by(df, :a, c_sum = sum(:c), c_mean = mean(:c))
4×3 DataFrames.DataFrame
4×3 DataFrame
│ Row │ a │ c_sum │ c_mean │
├─────┼───┼──────────┼──────────┤
│ 1 │ 1 │ 1.27638 │ 0.63819 │
Expand All @@ -650,7 +650,7 @@ julia> @by(df, :a, c_sum = sum(:c), c_mean = mean(:c))
│ 4 │ 4 │ -2.42621 │ -1.2131 │
julia> @by(df, :a, c = :c, c_mean = mean(:c))
8×3 DataFrames.DataFrame
8×3 DataFrame
│ Row │ a │ c │ c_mean │
├─────┼───┼───────────┼──────────┤
│ 1 │ 1 │ 0.61491 │ 0.63819 │
Expand Down Expand Up @@ -732,7 +732,7 @@ Select and transform columns.
julia> using DataFrames, DataFramesMeta
julia> df = DataFrame(a = repeat(1:4, outer = 2), b = repeat(2:-1:1, outer = 4), c = randn(8))
8×3 DataFrames.DataFrame
8×3 DataFrame
│ Row │ a │ b │ c │
├─────┼───┼───┼───────────┤
│ 1 │ 1 │ 2 │ -0.354685 │
Expand All @@ -745,7 +745,7 @@ julia> df = DataFrame(a = repeat(1:4, outer = 2), b = repeat(2:-1:1, outer = 4),
│ 8 │ 4 │ 1 │ -0.460486 │
julia> @select(df, :c, :a)
8×2 DataFrames.DataFrame
8×2 DataFrame
│ Row │ c │ a │
├─────┼───────────┼───┤
│ 1 │ -0.354685 │ 1 │
Expand All @@ -758,7 +758,7 @@ julia> @select(df, :c, :a)
│ 8 │ -0.460486 │ 4 │
julia> @select(df, :c, x = :b + :c)
8×2 DataFrames.DataFrame
8×2 DataFrame
│ Row │ c │ x │
├─────┼───────────┼───────────┤
│ 1 │ -0.354685 │ 1.64531 │
Expand Down
4 changes: 2 additions & 2 deletions src/byrow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ julia> @byrow! df begin
:A = 0
end
end
3×2 DataFrames.DataFrame
3×2 DataFrame
│ Row │ A │ B │
├─────┼───┼───┤
│ 1 │ 1 │ 2 │
Expand All @@ -115,7 +115,7 @@ julia> df2 = @byrow! df begin
@newcol colX::Array{Float64}
:colX = :B == 2 ? pi * :A : :B
end
3×3 DataFrames.DataFrame
3×3 DataFrame
│ Row │ A │ B │ colX │
├─────┼───┼───┼─────────┤
│ 1 │ 1 │ 2 │ 3.14159 │
Expand Down
4 changes: 2 additions & 2 deletions src/linqmacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ julia> x1 = @linq transform(where(df, :a .> 2, :b .!= "c"), y = 10 * :x);
julia> x1 = @linq by(x1, :b, meanX = mean(:x), meanY = mean(:y));
julia> @linq select(orderby(x1, :b, -:meanX), var = :b, :meanX, :meanY)
3×3 DataFrames.DataFrame
3×3 DataFrame
│ Row │ var │ meanX │ meanY │
├─────┼─────┼──────────┼─────────┤
│ 1 │ "a" │ 0.665682 │ 6.65682 │
Expand All @@ -53,7 +53,7 @@ julia> @linq df |>
by(:b, meanX = mean(:x), meanY = mean(:y)) |>
orderby(:meanX) |>
select(:meanX, :meanY, var = :b)
4×3 DataFrames.DataFrame
4×3 DataFrame
│ Row │ meanX │ meanY │ var │
├─────┼──────────┼─────────┼─────┤
│ 1 │ 0.353205 │ 3.53205 │ "a" │
Expand Down

2 comments on commit b8f3524

@bkamins
Copy link
Member Author

@bkamins bkamins commented on b8f3524 May 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/14302

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.1 -m "<description of version>" b8f3524c9d15d8d180b3cdf0e8bfdfd5b581e0ce
git push origin v0.5.1

Please sign in to comment.