File tree Expand file tree Collapse file tree 6 files changed +69
-0
lines changed Expand file tree Collapse file tree 6 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,17 @@ Coalesce
5050Coerce
5151```
5252
53+ ## RowTable
54+
55+ ``` @docs
56+ RowTable
57+ ```
58+
59+ ## ColTable
60+ ``` @docs
61+ ColTable
62+ ```
63+
5364## Identity
5465
5566``` @docs
Original file line number Diff line number Diff line change 3434 Replace,
3535 Coalesce,
3636 Coerce,
37+ RowTable,
38+ ColTable,
3739 Identity,
3840 Center,
3941 Scale,
Original file line number Diff line number Diff line change @@ -217,6 +217,8 @@ include("transforms/rename.jl")
217217include (" transforms/replace.jl" )
218218include (" transforms/coalesce.jl" )
219219include (" transforms/coerce.jl" )
220+ include (" transforms/rowtable.jl" )
221+ include (" transforms/coltable.jl" )
220222include (" transforms/identity.jl" )
221223include (" transforms/center.jl" )
222224include (" transforms/scale.jl" )
Original file line number Diff line number Diff line change 1+ # ------------------------------------------------------------------
2+ # Licensed under the MIT License. See LICENSE in the project root.
3+ # ------------------------------------------------------------------
4+
5+ """
6+ ColTable()
7+
8+ The transform that applies the function `Tables.columntable` to to the input table.
9+ """
10+ struct ColTable <: Stateless end
11+
12+ apply (:: ColTable , table) = Tables. columntable (table), table
13+
14+ revert (:: ColTable , newtable, cache) = cache
Original file line number Diff line number Diff line change 1+ # ------------------------------------------------------------------
2+ # Licensed under the MIT License. See LICENSE in the project root.
3+ # ------------------------------------------------------------------
4+
5+ """
6+ RowTable()
7+
8+ The transform that applies the function `Tables.rowtable` to to the input table.
9+ """
10+ struct RowTable <: Stateless end
11+
12+ apply (:: RowTable , table) = Tables. rowtable (table), table
13+
14+ revert (:: RowTable , newtable, cache) = cache
Original file line number Diff line number Diff line change 859859 @test rt == rtₒ
860860 end
861861
862+ @testset " RowTable" begin
863+ a = [3 , 2 , 1 , 4 , 5 , 3 ]
864+ b = [1 , 4 , 4 , 5 , 8 , 5 ]
865+ c = [1 , 1 , 6 , 2 , 4 , 1 ]
866+ t = Table (; a, b, c)
867+ T = RowTable ()
868+ n, c = apply (T, t)
869+ tₒ = revert (T, n, c)
870+ @test typeof (n) <: Vector
871+ @test Tables. rowaccess (n)
872+ @test typeof (tₒ) <: Table
873+ end
874+
875+ @testset " ColTable" begin
876+ a = [3 , 2 , 1 , 4 , 5 , 3 ]
877+ b = [1 , 4 , 4 , 5 , 8 , 5 ]
878+ c = [1 , 1 , 6 , 2 , 4 , 1 ]
879+ t = Table (; a, b, c)
880+ T = ColTable ()
881+ n, c = apply (T, t)
882+ tₒ = revert (T, n, c)
883+ @test typeof (n) <: NamedTuple
884+ @test Tables. columnaccess (n)
885+ @test typeof (tₒ) <: Table
886+ end
887+
862888 @testset " Identity" begin
863889 x = rand (4000 )
864890 y = rand (4000 )
You can’t perform that action at this time.
0 commit comments