From e07bddfb708e452c13bca4ba3ee89690ca1448bb Mon Sep 17 00:00:00 2001 From: xiaodaigh Date: Fri, 30 Jul 2021 22:06:41 +1000 Subject: [PATCH] minor --- Project.toml | 6 ++++-- src/nest.jl | 12 ------------ test/nest.jl | 11 +++++++++++ 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 test/nest.jl diff --git a/Project.toml b/Project.toml index e857bd2..044b69b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DataConvenience" uuid = "3b531cbf-ee43-4e67-8118-dca2c9372f86" authors = ["Dai ZJ "] -version = "0.3.2" +version = "0.3.3" [deps] CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" @@ -21,10 +21,12 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" [compat] -CSV = "0.7, 0.8" CategoricalArrays = "0.7, 0.8, 0.9, 0.10" +CSV = "0.7, 0.8" DataFrames = "1" Missings = "1" +PooledArrays = "1" +ShortStrings = "0.3" SortingLab = "0.2" StatsBase = "0.32, 0.33" TableOperations = "1" diff --git a/src/nest.jl b/src/nest.jl index 126266d..847ee0b 100644 --- a/src/nest.jl +++ b/src/nest.jl @@ -17,15 +17,3 @@ function unnest(df, val) tmp = [crossjoin(df[i:i, Not(val)], sdf) for (i, sdf) in enumerate(df[!, val])] reduce(vcat, tmp) end - -if false - df = DataFrame( -        a = rand(1:8, 1000), -        b = rand(1:8, 1000), -        c = rand(1:8, 1000), -    ) - - nest(df, :a, :meh) - unnest(nest(df, :a, :meh), :meh) -end - diff --git a/test/nest.jl b/test/nest.jl new file mode 100644 index 0000000..1dcc2ab --- /dev/null +++ b/test/nest.jl @@ -0,0 +1,11 @@ +using DataFrames +using DataConvenience + +df = DataFrame( +        a = rand(1:8, 1000), +        b = rand(1:8, 1000), +        c = rand(1:8, 1000), +    ) + +nest(df, :a, :meh) +unnest(nest(df, :a, :meh), :meh)