From de8411a52524d5a594a482d090b6b94527787ad0 Mon Sep 17 00:00:00 2001 From: lrennels Date: Tue, 1 Dec 2020 00:04:38 -0800 Subject: [PATCH 1/2] Update DataFrames project toml; fix deprecations --- Project.toml | 2 +- src/explorer/buildspecs.jl | 9 +++++---- src/mcs/montecarlo.jl | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index b871b653f..843689766 100644 --- a/Project.toml +++ b/Project.toml @@ -69,7 +69,7 @@ MacroTools = "0.5" FileIO = "1" julia = "1.4" GlobalSensitivityAnalysis = "1.0" -DataFrames = "0.19.1, 0.20, 0.21" +DataFrames = "0.19.1, 0.20, 0.21, 0.22" Electron = "1.1, 2.0, 3.0" FilePaths = "0.8" diff --git a/src/explorer/buildspecs.jl b/src/explorer/buildspecs.jl index fa33be45e..cc113f3a7 100644 --- a/src/explorer/buildspecs.jl +++ b/src/explorer/buildspecs.jl @@ -1053,10 +1053,11 @@ function trumpet_df_reduce(df, plottype::Symbol) i != col_index && push!(groupby_keys, names(df)[i]) end - df_new = by(df, groupby_keys, value = col => minimum) - append!(df_new, by(df, groupby_keys, value = col => maximum)) - append!(df_new, by(df, groupby_keys, value = col => mean)) - rename!(df_new, :value => col) + gd = DataFrames.groupby(df, groupby_keys) + + df_new = rename!(combine(gd, col => maximum), Symbol(col, :_maximum) => col) + append!(df_new, rename!(combine(gd, col => minimum), Symbol(col, :_minimum) => col)) + append!(df_new, rename!(combine(gd, col => mean), Symbol(col, :_mean) => col)) if plottype == :trumpet reorder_cols = [groupby_keys[1], col, groupby_keys[2:end]...] diff --git a/src/mcs/montecarlo.jl b/src/mcs/montecarlo.jl index 1803a468e..a61b03eb3 100644 --- a/src/mcs/montecarlo.jl +++ b/src/mcs/montecarlo.jl @@ -64,13 +64,13 @@ function _store_param_results(m::AbstractModel, datum_key::Tuple{Symbol, Symbol} if haskey(results, datum_key) results_df = results[datum_key] else - types = [typeof(value), Int] + cols = [[], []] names = [datum_name, :trialnum] if has_scen - push!(types, String) + push!(cols, []) push!(names, :scen) end - results_df = DataFrame(types, names, 0) + results_df = DataFrame(cols, names) results[datum_key] = results_df end From 5cc98c7211f752f8a5321fe4dc16cfdff5df77ce Mon Sep 17 00:00:00 2001 From: Lisa Rennels <31779240+lrennels@users.noreply.github.com> Date: Thu, 3 Dec 2020 02:10:40 -0800 Subject: [PATCH 2/2] Update Project.toml --- Project.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9082c0aed..52c88b63d 100644 --- a/Project.toml +++ b/Project.toml @@ -71,7 +71,6 @@ FileIO = "1" julia = "1.4" GlobalSensitivityAnalysis = "1.0" DataFrames = "0.19.1, 0.20, 0.21, 0.22" -Electron = "1.1, 2.0, 3.0" FilePaths = "0.8" [targets]